public static Tuple <int, int> TestExtremumsContinuationFromAngle(List <Candle> candles, int monotoneCount, double minAngle, bool isMinimums) { var finder = new ExtremumsFinder(0); var extremums = finder.FindFirstExtremums(candles, isMinimums); int successCount = 0, failCount = 0; int currentMonotoneCount = 0; for (int i = 1; i < extremums.Count; ++i) { //var currentSign = Math.Sign(extremums[i].Value - extremums[i - 1].Value); bool currentTrend = extremums[i].Value > extremums[i - 1].Value; if (currentTrend == isMinimums) { currentMonotoneCount++; if (currentMonotoneCount >= monotoneCount && Math.Abs(GetLineAngle(extremums, monotoneCount)) > minAngle) { successCount++; } } else { if (currentMonotoneCount >= monotoneCount && Math.Abs(GetLineAngle(extremums, monotoneCount)) > minAngle) { failCount++; } currentMonotoneCount = 0; } } return(new Tuple <int, int>(successCount, failCount)); }
public static List <int> TestExtremumsContinuationLength(List <Candle> candles, int monotoneCount, bool isMinimums) { var finder = new ExtremumsFinder(0); var extremums = finder.FindFirstExtremums(candles, isMinimums); var lengths = new List <int>(); int currentMonotoneCount = 0; for (int i = 1; i < extremums.Count; ++i) { bool currentTrend = extremums[i].Value > extremums[i - 1].Value; if (currentTrend == isMinimums) { currentMonotoneCount++; } else { currentMonotoneCount = 0; } if (currentMonotoneCount >= monotoneCount) { lengths.Add(extremums[i].Value - extremums[i - 1].Value); } } return(lengths); }