29 private readonly
int _surroundingBarsCountForHighPoint;
30 private readonly
int _surroundingBarsCountForLowPoint;
44 public override bool IsReady => _windowHighs.IsReady && _windowLows.IsReady;
57 : this($
"PivotPointsHighLow({surroundingBarsCount})", surroundingBarsCount, surroundingBarsCount, lastStoredValues)
66 public PivotPointsHighLow(
int surroundingBarsCountForHighPoint,
int surroundingBarsCountForLowPoint,
int lastStoredValues = 100)
67 : this($
"PivotPointsHighLow({surroundingBarsCountForHighPoint},{surroundingBarsCountForLowPoint})", surroundingBarsCountForHighPoint, surroundingBarsCountForLowPoint, lastStoredValues)
78 public PivotPointsHighLow(
string name,
int surroundingBarsCountForHighPoint,
int surroundingBarsCountForLowPoint,
int lastStoredValues = 100)
81 _surroundingBarsCountForHighPoint = surroundingBarsCountForHighPoint;
82 _surroundingBarsCountForLowPoint = surroundingBarsCountForLowPoint;
86 WarmUpPeriod = Math.Max(_windowHighs.Size, _windowLows.Size);
96 _windowHighs.Add(input);
97 _windowLows.Add(input);
101 if (_windowHighs.IsReady)
106 if (_windowLows.IsReady)
111 OnNewPivotPointFormed(highPoint);
112 OnNewPivotPointFormed(lowPoint);
126 var middlePoint = windowLows[midPointIndexOrSurroundingBarsCount];
127 for (var k = 0; k < windowLows.
Size && isLow; k++)
129 if (k == midPointIndexOrSurroundingBarsCount)
134 isLow = windowLows[k].Low > middlePoint.Low;
155 var middlePoint = windowHighs[midPointIndexOrSurroundingBarsCount];
156 for (var k = 0; k < windowHighs.
Size && isHigh; k++)
159 if (k == midPointIndexOrSurroundingBarsCount)
165 isHigh = windowHighs[k].High < middlePoint.High;
185 if (highPoint !=
null)
187 if (lowPoint !=
null)
195 if (lowPoint !=
null)
208 _windowHighs.Reset();
210 _windowPivotPoints.Reset();
221 return _windowPivotPoints.Where(p => p.PivotPointType ==
PivotPointType.High).ToArray();
231 return _windowPivotPoints.Where(p => p.PivotPointType ==
PivotPointType.Low).ToArray();
242 return _windowPivotPoints.ToArray();
248 private void OnNewPivotPointFormed(
PivotPoint pivotPoint)
250 if (pivotPoint !=
null)
252 _windowPivotPoints.Add(pivotPoint);
271 public sealed
override decimal
Value {
get;
set; }