I am using OnBarClose in my strategy, but I am wondering some details about how this really works, from the platform side.
It is nearly impossible to tell (at least on most candle types) when the is last tick of a bar. On normal timed bars, you cannot really know until the new bar time. So if on a 1-minute chart, and it's the open candle, which will close at 12:35, then until 12:35 strikes, the platform cannot know whether another tick will slip in. So the first tick at/after 12:35:00 is really bar open.
Or in my case, using range bars, when the range is full, you are on the last tick, unless it retraces. It it continues, then the next tick starts a new bar, and that means it's really OnBarOpen.
So why does Ninja do OnBarClose, and what is the nitty-gritty of how it operates?
I presume that really OnBarClose is triggered on bar open, but that it's called bar close to signify that functions like OnBarUpdate() will be called first, before any processing of the new tick which confirmed the old bar was done.
Is that correct?


Comment