Esempio n. 1
0
        /// <summary>
        /// Whether the candle is bullish or bearish.
        /// </summary>
        /// <param name="candle">The candle which should be checked for the trend.</param>
        /// <returns><see langword="true" /> if bullish, <see langword="false" />, if bearish, <see langword="null" /> - neither one nor the other.</returns>
        public static bool?IsBullishOrBearish(this Candle candle)
        {
            if (candle == null)
            {
                throw new ArgumentNullException(nameof(candle));
            }

            var isWhiteOrBlack = candle.IsWhiteOrBlack();

            switch (isWhiteOrBlack)
            {
            case true:
                if (candle.GetBottomShadow() >= candle.GetBody())
                {
                    return(true);
                }
                break;

            case false:
                if (candle.GetTopShadow() >= candle.GetBody())
                {
                    return(true);
                }
                break;
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Whether the candle is dragonfly or tombstone.
        /// </summary>
        /// <param name="candle">The candle which should match the pattern.</param>
        /// <returns><see langword="true" /> if the dragonfly, <see langword="false" /> if the tombstone, <see langword="null" /> - neither one nor the other.</returns>
        public static bool?IsDragonflyOrGravestone(this Candle candle)
        {
            if (candle.IsWhiteOrBlack() == null)
            {
                if (candle.GetTopShadow() == 0)
                {
                    return(true);
                }
                else if (candle.GetBottomShadow() == 0)
                {
                    return(false);
                }
            }

            return(null);
        }