While I'm not new to indicator development, I certainly am a bit green on NinjaScript and C#.
I'm looking for the best way to detect the precise beginning of a market session, such as an event handler. Is there such a handler that can be hooked to within the context of an indicator?
I am aware that there are methods and properties that would allow for the detection of the first bar of a new session, i.e. Bars.FirstBarOfSession. However, this is related to the timeframe, and obviously will remain true for whatever price movements occur within that first bar, causing issues for indicators that need to refresh at exact market open (i.e. VWAP).
I've also considered hardcoding the session times, but this poses an obvious issue when moving between asset classes or exchanges and for 'odd cases' like holidays or other exceptions.
Is there a clean way, using the API, to have a method invoke only once at the very beginning of a new market session to do bookkeeping and housecleaning for session-based indicators?
TIA,
nukespace
Comment