Open kenorb opened 11 months ago
bool IsValidWedge(int startIndex, int totalBars, const double &high[], const double &low[], int direction) { double trendlineSlope = (high[startIndex] - low[startIndex]) / 2; double prevSlope = 0; for (int i = startIndex; i > startIndex - totalBars; i--) { double slope = (high[i] - low[i]) / 2; if (direction * slope < 0) return false; if (direction * prevSlope > 0) return false; prevSlope = slope; if (MathAbs(slope) > MathAbs(trendlineSlope)) return false; } return true; }