calculate method
Calculates the value of this indicator for the given index without caching it.
Returns the result as a T.
Implementation
@override
T calculate(int index) {
if (index + 1 < period) {
// Starting point of the ZLEMA
return SMAIndicator<T>(indicator, period).getValue(index);
}
if (index == 0) {
// If the period is bigger than the indicator's value count
return indicator.getValue(0);
}
final double prevZlema = getValue(index - 1).quote;
return createResult(
index: index,
quote: (_k *
((2 * indicator.getValue(index).quote) -
indicator.getValue(index - _lag).quote)) +
((1 - _k) * prevZlema),
);
}