The Yin Yang Hanging Man strategy is a quantitative trading strategy based on the hanging man candlestick pattern. This strategy generates trading signals by identifying hanging man patterns in candlestick charts. When a hanging man pattern is identified, a buy signal is generated for a bullish hanging man, while a sell signal is generated for a bearish hanging man.
The core identification condition of the Yin Yang Hanging Man strategy is the hanging man candlestick pattern with a small real body and long upper/lower shadows. Specifically, the identification conditions for a hanging man are:
When the above conditions are met, the pattern can be identified as a hanging man. Moreover, more specific types of hanging mans like bullish/bearish or long-legged can be distinguished based on the relative sizes of the upper and lower shadows. After identifying the pattern, the strategy generates trading signals on the next candlestick, i.e. buy on bullish hanging man, sell on bearish hanging man.
The Yin Yang Hanging Man strategy has the following main advantages:
However, there are some limitations to the strategy as well:
The main risks of this strategy stem from:
Also, single indicator strategies cannot filter market noise effectively and can generate misleading signals. So the Yin Yang strategy has relatively large risks and fluctuations that necessitate robust risk management.
To control risks, the strategy can be improved in the following ways:
With these enhancements, the risks can be reduced significantly while improving stability of the Yin Yang hanging man strategy.
To summarize, the Yin Yang Hanging Man strategy generates trade signals by identifying hanging man patterns in candlestick charts. It has the advantage of simple rules and catching reversals but also risks of false signals. The risks can be controlled through parameter tuning, adding filters etc but sensitivity to noise and fluctuations remains high. So the strategy warrants prudent application despite enhancements.
/*backtest start: 2024-01-24 00:00:00 end: 2024-01-31 00:00:00 period: 1m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Doji Candlestick Strategy", shorttitle="Doji", overlay=true) // Calculate body and shadow sizes bodySize = close > open ? close - open : open - close upperShadow = high - (open > close ? open : close) lowerShadow = (open > close ? close : open) - low // Define thresholds for identifying different Doji types dojiThreshold = 0.05 longLeggedDojiThreshold = 0.02 // Buy conditions for different Doji types dojiCondition = bodySize <= dojiThreshold and upperShadow > bodySize * 2 and lowerShadow > bodySize * 2 dragonflyDojiCondition = bodySize <= dojiThreshold and upperShadow > bodySize * 2 and lowerShadow <= bodySize * 0.5 gravestoneDojiCondition = bodySize <= dojiThreshold and upperShadow <= bodySize * 0.5 and lowerShadow > bodySize * 2 longLeggedDojiCondition = bodySize <= longLeggedDojiThreshold and upperShadow > bodySize * 2 and lowerShadow > bodySize * 2 // Buy signal buyCondition = dojiCondition or dragonflyDojiCondition or gravestoneDojiCondition or longLeggedDojiCondition // Strategy orders strategy.entry("Buy", strategy.long, when=buyCondition) // Plotting plotshape(series=buyCondition, title="Buy Signal", color=color.green, style=shape.triangleup, location=location.belowbar, size=size.small)