示例#1
0
        /// <summary>
        /// Returns if the angle between all the waves is in an acceptable range.
        /// </summary>
        /// <param name="points">Array of points making up the waves</param>
        /// <returns>See Summary</returns>
        private bool AreWaveAnglesInRange(List <ZigZagWaves.WavePoint> points)
        {
            double lastWaveAngle  = UtilityMethods.CalculateAngle(points[0].Price, points[1].Price, points[2].Price, points[0].Bar, points[1].Bar, points[2].Bar);
            double firstWaveAngle = UtilityMethods.CalculateAngle(points[1].Price, points[2].Price, points[3].Price, points[1].Bar, points[2].Bar, points[3].Bar);

            if (lastWaveAngle > 160 || lastWaveAngle < 20 || firstWaveAngle > 160 || firstWaveAngle < 20)
            {
                return(false);
            }

            // Make sure the waves aren't too different from each other. Like a steep wave then a really
            // shallow wave with not much price change.
            if (Math.Abs(lastWaveAngle - firstWaveAngle) > 50)
            {
                return(false);
            }

            return(true);
        }