Type : Signal, Name : 20 Day Break System
Inputs: Length(20);
Vars: TrailStop(0);
TrailStop = Highest(High,Length) — Lowest(Low,Length);
{Entries}
If Close > Highest(Close,Length)[1] then Buy («BrkOut LE») next bar at open;
If Close < Lowest(Close,Length)[1] then Sell («BrkOut SE») next bar at open;
{Exits}
If MarketPosition = 1 then begin
ExitLong («TrailStop LX») at Highest(High,Length) — TrailStop on stop;
end;
If MarketPosition = -1 then begin
ExitShort («TrailStop SX») at Lowest(Low,Length) + TrailStop on stop;
end;