27 private decimal _sumRoc1;
28 private decimal _periodRoc;
29 private decimal _trailingValue;
42 : base(name, period + 1)
51 : this($
"KER({period})", period)
67 _sumRoc1 += Math.Abs(input.
Value - window[1].Value);
75 _sumRoc1 += Math.Abs(input.
Value - window[1].Value);
78 var newTrailingValue = window[
Period - 1];
79 _periodRoc = input.
Value - newTrailingValue.Value;
86 _sumRoc1 -= Math.Abs(_trailingValue - newTrailingValue.Value);
87 _sumRoc1 += Math.Abs(input.
Value - window[1].Value);
90 _trailingValue = newTrailingValue.Value;
93 return _sumRoc1 <= _periodRoc || _sumRoc1 == 0 ? 1m : Math.Abs(_periodRoc / _sumRoc1);