I am reviewing the above sample strategy since I am interested in developing a new strategy based on the same concept. I was a bit confused about how the strategy engine works as bars are constructed, but I think I have it worked out. Please advise if I have this straight in my mind:
From what I have read and seen in the sample, it seems that during OnBarUpdate(), when Calculate == OnBarClose and IsFirstTickOfBar == true, a reference to any Bar data series such as Close[] with an index of 0 would refer to data of the bar that just closed. But if Calculate == OnPriceChange or OnEachTick, then the the index of 0 would point to the current bar that has just received its first tick and is in the process of being built. Is this correct?
If so, this means that if Calculate == OnBarClose, then IsFirstTickOfBar is always true and actually means IsLastTickOfBar (and, in effect also means "OnlyTickOfBar"). Correct?
And all this would be true only for real-time operation with a live market data feed, or with Historical data if using Market Replay or Tick Replay. Otherwise only OnBarClose is valid. Correct?
Thanks,
CJ
Comment