Re what I said earlier: I wasn't very clear here. I mean any order to be executed on the Close of the last intra-day bar of the day (instead of Close of the current bar) when you will be checking for the Date of Next Bar. I might not be entirely correct here. MOO will not work. Not sure about normal on Close order. I am no longer using intra-day data so I am not able to test it out myself.
I've found that there are too many sessions that close earlier than the regular session close, but virtually all sessions open at the right time. What I would do is just exit at the close of the first 5-min. bar. ExitTime = CalcTime(SessionStartTime(0,1), BarInterval); ExitLevel = Close; If Time = ExitTime Then Sell ("Exit") Next Bar at ExitLevel Limit; If you can't stand waiting the five minutes, you can exit on the end of the first tick of the session by enabling intrabarordergeneration. RoughTrader
RoughTrader, thanks for your input on this. I agree ⦠there are too many early closes that need to be addressed differently. However regards exiting on the close of the first 5 minute bar, my preference is very much for the open. Unfortunately I only have 5 minute (rather than tick) data so canât test exiting on the end of the first tick. That said Iâm pretty happy with ChoSingKumâs suggestion of ⦠"If Date < Date of Next Bar then ... ;" ⦠this now works well for me.
You misunderstood what I meant about exit on the close of the first tick. TS offers the ability to execute order inside a bar, so you don't have to wait until the bar is closed to issue an order. If you enable "intrabar order generation" in your strategy, you can write code so that the first tick movement after the open you will exit your position. You don't need tick data. You can just assume that your fill will be close enough to the opening price that any difference can be regarded as slippage. RoughTrader
Hi RoughTrader, Jock will not be able to use the IntraBarOrderGeneration attribute in his TS 2000i. Also no SessionStartTime(x,x). These are only available in versions after TS 2000i.