calculate method

  1. @override
T calculate(
  1. int index
)
override

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 < 2 || index > entries.length - 3) {
    return createResult(index: index, quote: double.nan);
  }
  if (entries[index].high > entries[index - 1].high &&
      entries[index].high > entries[index - 2].high &&
      entries[index].high > entries[index + 1].high &&
      entries[index].high > entries[index + 2].high) {
    return createResult(index: index, quote: entries[index].high);
  } else {
    return createResult(index: index, quote: double.nan);
  }
}