SMIIndicator<T extends IndicatorResult> constructor

SMIIndicator<T extends IndicatorResult>(
  1. IndicatorDataInput input, {
  2. int period = 10,
  3. int smoothingPeriod = 3,
  4. int doubleSmoothingPeriod = 3,
})

Initializes and returns an instance of SMIIndicator.

Implementation

factory SMIIndicator(
  IndicatorDataInput input, {
  int period = 10,
  int smoothingPeriod = 3,
  int doubleSmoothingPeriod = 3,
}) {
  final LowestValueIndicator<T> ll =
      LowestValueIndicator<T>(LowValueIndicator<T>(input), period);
  final HighestValueIndicator<T> hh =
      HighestValueIndicator<T>(HighValueIndicator<T>(input), period);

  final DifferenceIndicator<T> diff = DifferenceIndicator<T>(hh, ll);
  final DifferenceIndicator<T> rDiff = DifferenceIndicator<T>(
    CloseValueIndicator<T>(input),
    MeanIndicator<T>(hh, ll),
  );

  return SMIIndicator<T>._(
    input,
    EMAIndicator<T>(
      EMAIndicator<T>(rDiff, smoothingPeriod),
      doubleSmoothingPeriod,
    ),
    EMAIndicator<T>(
      EMAIndicator<T>(diff, smoothingPeriod),
      doubleSmoothingPeriod,
    ),
  );
}