S#

Candle.IsBullishOrBearish() never returns false (i.e. is never Bearish!)


Candle.IsBullishOrBearish() never returns false (i.e. is never Bearish!)
Atom
2/5/2017


I noticed that the above method never returns 'false' and so cannot indicate bearish signals. The source code is as follows:

Код
/// <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;
        }


I'm guessing that the second case should return 'false' . It looks to me like the top case is looking for an inverted hammer (bullish), whereas the bottom case is looking for a shooting star (bearish). However shouldn't it also be looking at the other shadows in each case since we want a short shadow opposite the long shadows for both inverted hammer and shooting start right?? Am I missing something?






Thanks:




1 Answers
Mikhail Sukhov

Avatar
Articles author Programmer Trader
Date: 2/6/2017
Reply


I think you right. There is no code line for false return. It is definitely wrong.
Thanks:


Attach files by dragging & dropping, , or pasting from the clipboard.

loading
clippy