Can't get this to work. Want to short the days open to close, condition is that the day before price criss crosses the high of the day before that (highd(1)) a few times (4-6). Can't get it to short on the open, it just short after enough crosses. Appreciate any help!!
Code: Select all
Inputs: Price(H+L/2),profitstop(4500), highCrosseson1(4);
vars: highdCrosseson1(0), newday(false);
// Yesterday, price criss crosses around yesterday's high several times.
// Let's count those crosses
if marketposition = 0 and price crosses over highd(1) then begin;
highdCrosseson1 = highdCrosseson1 + 1;
end;
// Trade only the next day
if date[1] < date then begin
newday=true;
end;
// Yesterday High crosses enough and its a new day
if highdCrosseson1 >= highCrosseson1 and newday then begin;
{price cross below lowd(1)} sellshort this bar at close;
end;
// Var Resets
if marketposition = -1 then begin;
highdCrosseson1 = 0;
end;
if date[1] < date then highdCrosseson1 = 0;
// Stops
setexitonclose;