Please help. My goal is to structure an indicator such that its operation historically will look identical under Calculate.OnBarUpdate and Calculate.OnEachTick (OR Calculate.OnPriceChange).
The indicator would have an internal List which is constructed by incrementally adding values from the last completed bar of a PriceSeries (e.g. Close[0]). Critically, each completed bar is added to the List once and once only (i.e. no missed bar and no duplicates).
The last completed bar under Calculate.OnBarClose is Bar[0]. The last completed bar under Calculate.OnEachTick is Bar[1] (i.e. Bar[0] is developing).
Critically, in the transition from Historical to Realtime, the List must have no missed bar and no duplicates.
Please find attached an ExampleIndicator which successfully implements the above. The Indicator can be tested on a chart with an existing SMA[8], added under Calculate.OnBarClose and under Calculate.OnEachTick. It will look identical historically and in realtime.
While this ExampleIndicator works, its logic is far from straightforward.
Is there a more simple approach to implement the above? A reference sample perhaps? Most likely working with the different States (i.e. .Historical, .Transition, and .Realtime)
As always, thanks
Shannon
Comment