Custom Indicators API - Add Candle Transition Callback

For an indicator I’m writing, I would like to cache properties calculated over the previous N bars, and do disjoint, simpler calculations on the current bar relative to those properties. However, with the current API and documentation, the function is called for every bar with the state of N-1 as the input Calculator object. This makes sense for a lot of indicators, but doesn’t allow state caching for more complicated indicators.

Is there an optional callback that could be added to call the Calculator object at the open of each new bar as a transition step so that any calculation that uses calculations on historic data can be cached?

I don’t think what you are asking is available.

But if you would like to keep a cache of sorts, I have found that storing it outside of your indicator’s calculator class does the trick. It essentially becomes a globally scoped variable/property instead of class scoped. I have found class scoped properties don’t always persist because the indicator class gets re-instantiated, etc. I don’t really know the reason, but I am sure it has to do with the performance optimizations they have in place.

Hope that helps.