50 : this($
"APS({period})", period)
63 throw new ArgumentException(
"AugenPriceSpike Indicator must have a period of at least 3", nameof(period));
73 public override bool IsReady => _rollingData.IsReady && _standardDeviation.IsReady;
87 _rollingData.Add(input.
Value);
88 if (_rollingData.Count < 3) {
return 0m; }
90 var previousPoint = _rollingData[1];
91 var previousPoint2 = _rollingData[2];
95 if (previousPoint != 0 && previousPoint2 != 0)
97 logPoint = Math.Log((
double)previousPoint / (
double)previousPoint2);
100 _standardDeviation.Update(input.
Time, (decimal)logPoint);
102 if (!_rollingData.IsReady) {
return 0m; }
103 if (!_standardDeviation.IsReady) {
return 0m; }
105 var m = _standardDeviation.Current.Value * previousPoint;
106 if (m == 0) {
return 0; }
108 var spikeValue = (input.
Value - previousPoint) / m;
117 _standardDeviation.Reset();
118 _rollingData.Reset();