PureBytes Links
Trading Reference Links
|
> I want to exit on the last bar of the day and if the position is
> long, open long at nexts day opening.
if Time = Sess1EndTime then begin
if MarketPosition = 1 then begin
exitlong;
buy next bar at open;
end;
if MarketPosition = -1 then
exitshort;
end;
This won't work properly on days that are missing the last bar, such
as early-closing holidays. If it's critical that the code work every
day, then instead of "if Time = Sess1EndTime" you can use "if Date of
next bar <> Date". However this limits the kinds of orders you can
use, as we've discussed recently on the list, such as in
http://www.purebytes.com/archives/omega/2002/msg03023.html
Gary
|