I'm testing a Breakout system on 30 min. bars and trying to incorporate a Trailing $Stop.
My problem is when the Stop is elected the program immediately reinitiates the trade at the Stop price or Open. Am I missing or not understanding something?? Allen
Input: Sig(2), RangeBegin(0830), DayClose(1630), TR(500);
Vars: Hi(0), Lo(99999), LS(0), SS(0);
If time = RangeBegin then begin
Hi = 0;
Lo = 99999;
end;
If time = RangeBegin then begin
Hi = High;
Lo = Low;
LS = Hi + Sig; SS = Lo - Sig;
end;
If time >= RangeBegin and time < DayClose then begin
Buy at LS point Stop;
Sell at SS point Stop;
SetStopPosition; SetDollarTrailing(TR);
end;
If Time = DayClose and Marketposition <> 0 then begin
ExitLong this bar on Close;
ExitShort this bar on Close;
end;
My problem is when the Stop is elected the program immediately reinitiates the trade at the Stop price or Open. Am I missing or not understanding something?? Allen
Input: Sig(2), RangeBegin(0830), DayClose(1630), TR(500);
Vars: Hi(0), Lo(99999), LS(0), SS(0);
If time = RangeBegin then begin
Hi = 0;
Lo = 99999;
end;
If time = RangeBegin then begin
Hi = High;
Lo = Low;
LS = Hi + Sig; SS = Lo - Sig;
end;
If time >= RangeBegin and time < DayClose then begin
Buy at LS point Stop;
Sell at SS point Stop;
SetStopPosition; SetDollarTrailing(TR);
end;
If Time = DayClose and Marketposition <> 0 then begin
ExitLong this bar on Close;
ExitShort this bar on Close;
end;