public void GetPivotPointsLevels_GivenBullishTrend_ShouldReturnExtensionLevelGreaterThanPointAandB(double high, double low, double close, PivotPointsType type = PivotPointsType.Default)
        {
            //Arrange
            //Act
            var pivotPoints = (type == PivotPointsType.Default) ? PivotPoints.GetPivotPointsLevels(high, low, close) : PivotPoints.GetPivotPointsLevels(high, low, close, type);

            //Assert
            Assert.Greater(pivotPoints.R2, pivotPoints.R1);
            Assert.Greater(pivotPoints.R1, pivotPoints.PivotPoint);

            Assert.Less(pivotPoints.S2, pivotPoints.S1);
            Assert.Less(pivotPoints.S1, pivotPoints.PivotPoint);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get commonly known PivotPoints types.
        /// </summary>
        /// <param name="high"></param>
        /// <param name="low"></param>
        /// <param name="close"></param>
        /// <param name="type">Type of PivotPoints to get, default is ClassicOrStandard.</param>
        /// <returns></returns>
        public static PivotLevelsBase GetPivotPointsLevels(double high, double low, double close, PivotPointsType type = PivotPointsType.ClassicOrStandard)
        {
            //https://www.babypips.com/tools/pivot-point-calculator
            //https://www.babypips.com/learn/forex/other-pivot-point-calculation-methods
            switch (type)
            {
            case PivotPointsType.Camarilla:
                return(GetCamarillaPivotPoints(high, low, close));

            case PivotPointsType.Woodie:
                return(GetWoodiePivotPoints(high, low, close));

            case PivotPointsType.Fibonacci:
                return(GetFibonacciPivotPoints(high, low, close));

            case PivotPointsType.ClassicOrStandard:
            case PivotPointsType.Default:
                return(GetClassicOrStandardPivotPoints(high, low, close));
            }

            throw new InvalidOperationException();
        }