This TradeStation EndOfSession code doesn't make sense to me

124 views
Skip to first unread message

Larry

unread,
Dec 24, 2017, 9:34:52 AM12/24/17
to Adaptrade Builder
In TradeStation code, you do the following:

EndofSess = false;
If DataCompression >= 1 and DataCompression <= 4 then
    EndofSess = (Time = SessionEndTime(0, 1));

{ Entry orders }
If (MarketPosition = 0 or EndofSess) and EntCondL and TimeOK then begin
    Buy("EnStop-L") NShares shares next bar at EntPrL stop;
end;

To me, this says, enter if EndOfSess is TRUE. Why wouldn't that be the reverse and use !EndOfSess? You don't want to enter if EndOfSess is TRUE, right?




Michael R. Bryant

unread,
Dec 24, 2017, 3:49:37 PM12/24/17
to adaptrad...@googlegroups.com

That applies when you’re using an end-of-day exit. It allows entries at the open of the next session even when the position is not flat on the last bar of the session. That’s necessary because the end-of-day exit will exit the open position before the next session, so, without it, you’d miss an entry at the next session’s open.

 

Mike Bryant

Reply all
Reply to author
Forward
0 new messages