/// <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 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); }
/// <summary> /// Whether the candle is hammer. /// </summary> /// <param name="candle">The candle which should match the pattern.</param> /// <returns><see langword="true" /> if it is matched, <see langword="false" /> if not.</returns> public static bool IsHammer(this Candle candle) { return(!candle.IsMarubozu() && (candle.GetBottomShadow() == 0 || candle.GetTopShadow() == 0)); }
/// <summary> /// Whether the candle is neutral to trades. /// </summary> /// <param name="candle">The candle for which you need to calculate whether it is neutral.</param> /// <returns><see langword="true" /> if the candle is neutral, <see langword="false" /> if it is not neutral.</returns> /// <remarks> /// The neutrality is defined as a situation when during the candle neither buyers nor sellers have not created a trend. /// </remarks> public static bool IsSpinningTop(this Candle candle) { return(!candle.IsMarubozu() && (candle.GetBottomShadow() == candle.GetTopShadow())); }