[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with cancel and replace stop



PureBytes Links

Trading Reference Links

Trying to place a stop for a long position at the last low based on
the low having 2 higher lows to the left and two higher lows to the
right and the opposite for a short position i.e. a stop at the last
high based on the high having 2 lower highs to the left and 2 lower
highs to the right. 

Any help greatly appreciated

Ned


Vars: OrderPrice(0);

If MarketPosition<>0 Then Begin    
      If MarketPosition = -1
      and BarsSinceEntry > 5 then begin
      If high[5]<high[3]
      and high[4]<high[3]
      and high[2]<high[3]
      and high[1]<high[3]
      Then OrderPrice = high[3];

      If OrderPrice < EntryPrice then begin
      ExitShort ("CRXS") Next Bar at OrderPrice Stop;
      End;

      If MarketPosition = 1
      and BarsSinceEntry > 5 then begin
      If low[5]>low[3]
      and low[4]>low[3]
      and low[2]>low[3]
      and low[1]>low[3]
      Then OrderPrice = low[3];

      If OrderPrice > EntryPrice Then Begin
      ExitLong ("CRXL") Next Bar at OrderPrice Stop;
      End;
End; 
End;
End;