I there an easy way to access the previous value of an indicator? e.g. 1 -the easiest way to compute an exponential moving average , is to take the previous value of the same ema, multiply that by (1-lambda) and add lambda * the current value . 2- if i hold a counter , to count the number of bars since the last true value of a pattern indicator, the easy way is to increment the last value of the counter (unless that pattern is true, so it resets.)
so what i am asking is, if i am writing a function that will calculate f(x) , and assume that after all the calculation, this function is called on startIndex=endIndex= x, how can i access f(x-1) easily ?
---
i know i can get the current value (or previous using shift) of a function via the IIndicators interface
but then calling it from within itself risks deep recursion.
___ ok thath last bit was a mistake, but i am leaving it up there for reference. that is the wrong kind of context. the IContext interface is available to strategies and not to indicators. the IIndicatorContext is available to indicators and it doesn't give the getinddicators
API Support
Post subject: Re: getting previous values of an indicator wo risking recursion