the following is my exit code for a strategy that uses stop orders to get in on breakouts:
Code: Select all
//"lowerband" and "upperband" corresponds to trailing stop code
If Marketposition=1 then begin
lstop=Maxlist(lowerband,(entryprice-(stopf)));
llimit=entryprice+(targetf);
sell from entry ("masterl") next bar at lstop stop;
sell from entry ("masterl") next bar at llimit limit;
end;
If Marketposition=-1 then begin
sstop=Minlist(upperband,(entryprice+(stopf)));
slimit=entryprice-(targetf);
Buytocover from entry ("masters") next bar at sstop stop;
Buytocover from entry ("masters") next bar at slimit limit;
end;
My strategy runs off of a 60 min chart. Am I right in assuming that I will not have a stop in place once an entry stop is executed until the next 60min candle?
How would I code a stop that is active immediately?
What settings would I need to backtest an intrabar generated stop?
Many thanks!