if time = 1615 then begin
hi = highd(0);
lo = lowd(0);
rng = hi - lo;
end;
if rng < 100 then rng = 100;
//contracts
value1 = ((SL/(rng/2))/10);
if value1 < 1 then value1 = 1;
if value1 > max_pos then value1 = max_pos;
//strategy
condition1 = highd(0) - lowd(0) > rng and time < 1800;
condition2 = EntriesToday(date) = 0;
if condition1 and condition2 then begin
if close > closem(1) and close > highd(1) then buy value1 contracts next bar at highd(0) stop;
if close < highm(1) and close < lowd(1) then sellshort value1 contracts next bar at lowd(0) stop;
end;