Behavior of StartDate = NOW;

Posted By: MegaTanker

Behavior of StartDate = NOW; - 04/21/22 09:34

According to the manual StartDate = NOW; will immediately trigger a run() in Trade mode which is useful for strategies that rebalance portfolios once in a while or similar.

It sounds useful for me but I must know how this affects bar generation. If it immediately builds a bar upon starting the session, does it use the last 24 hours with daily candles? Does it generate the Lookback period based on the current time such that all candles close and open consistently at this time of the day? Or does it still use the variables such as BarOffset to generate the bars normally, thus making only the last bar "malformed" if the session start doesn't align with the BarOffset in the script?

I tried figuring this out by logging the current timestamp at every bar, and it still prints the time determined by BarOffset, even for the first bar that is executed at session start, which doesn't align with the real time at that moment.
Posted By: jcl

Re: Behavior of StartDate = NOW; - 04/21/22 10:26

Yes, lookback etc still work. It only runs immediately at start and then at each normal bar boundary.
© 2024 lite-C Forums