34 private readonly
int? _minPeriod;
49 : base(name, fullPeriod)
53 throw new ArgumentException(
"The minimum period should be 4.", nameof(minPeriod));
55 _minPeriod = minPeriod;
66 : this($
"Momersion({minPeriod},{fullPeriod})", minPeriod, fullPeriod)
75 : this(null, fullPeriod)
86 if (_minPeriod.HasValue)
88 return _multipliedDiffWindow.Count >= _minPeriod;
90 return _multipliedDiffWindow.Samples > _multipliedDiffWindow.Size;
105 _multipliedDiffWindow.Reset();
118 if (window.
Count >= 3)
120 _multipliedDiffWindow.Add((window[0].Value - window[1].Value) * (window[1].Value - window[2].Value));
125 if (
IsReady && _multipliedDiffWindow.Count(obs => obs == 0) < 0.5 * _multipliedDiffWindow.Count)
127 var mc = _multipliedDiffWindow.Count(obs => obs > 0);
128 var mRc = _multipliedDiffWindow.Count(obs => obs < 0);
129 return 100m * mc / (mc + mRc);