if d<>d[1] then begin
if close>open then buy this bar on close ;
bb=high+10*MinMove/pricescale;
end;
if marketposition<0 then buytocover next bar bb stop;
var:buystop(0),sellstop(0);
if marketposition=0 then begin
buystop=0; sellstop=0;
end;
if d<>d[1] and marketposition=0 then begin
if close>open then begin
buy 1 contracts this bar on close ;
sellstop=low - 10 points;
buystop=0;
end;
if close<open then begin
SellShort 1 contracts this bar on close ;
buystop=hogh + 10 points;
sellstop=0;
end;
end;
if marketposition>0 and sellstop>0 then begin
sell 1 contracts next bar at sellstop stop;
rev=-1;
end;
if marketposition<0 and buystop>0 then begin
buytocover 1 contracts next bar at buystop stop;
rev=1;
end;
if d=d[1] and marketposition=0 then begin
if rev=1 then begin
buy 1 contracts this bar on close ;
sellstop=low - 10 points;
buystop=0;
end;
if rev=-1 then begin
SellShort 1 contracts this bar on close ;
buystop=hogh + 10 points;
sellstop=0;
end;
end;