/// <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); }
/// <summary> /// Whether the candle is shadowless. /// </summary> /// <param name="candle">The candle for which you need to identify the shadows presence.</param> /// <returns><see langword="true" /> if the candle has no shadows, <see langword="false" /> if it has shadows.</returns> public static bool IsMarubozu(this Candle candle) { if (candle == null) { throw new ArgumentNullException(nameof(candle)); } return(candle.GetLength() == candle.GetBody()); }