Blog / Strategy
Strategy

Hanging Man Reversal: Candlestick Strategy Rules Coded in MT5

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy – including backtests – does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The hanging man reversal strategy is a short-only, price-action swing trading system. It looks for the hanging man candlestick pattern at the top of a short-term advance and sells only after the market confirms the warning. It uses no indicators at all, so there are no moving averages, RSI or ATR. Every decision comes from the open, high, low and close of recent candles on one timeframe.

A hanging man candle has the same shape as a hammer. It has a small body near the top, a long lower wick (the thin line below the body, also called a shadow) and little or no upper wick. Where it appears is what makes it a hanging man. Buyers push price to a fresh high, sellers drive it well down inside the bar, and buyers only just pull it back to close near the top. The long lower wick suggests that supply may have appeared above the market for the first time in the run.

The Hanging Man Reversal EA is a counter-trend tool, meaning it trades against the recent direction of price. It works well as a learning tool because the rules are fully coded in the MQL5 source. You can study how a classic candlestick idea becomes objective, testable conditions.

Why the Hanging Man Reversal Strategy Waits for Confirmation

On its own, a hanging man is only a warning, and many of them appear in uptrends that keep going. So the system waits for the next candle to close below the hanging man's low. At that point, everyone who bought during that bar is holding a loss, and the logic assumes their exits may add to the selling pressure.

How It Works

The EA checks the chart once per completed candle, on the first tick of each new bar. The candle that just closed is the "confirmation candle" and the one before it is the possible hanging man. The strategy signals a short only when every condition below is true.

Step 1: A Short-Term Advance and a Fresh High

Step 2: The Hanging Man Candle Shape

The candle's range (high minus low) is split into body and wicks:

Step 3: The Confirmation Close

Stop-Loss and Take-Profit Logic

Position Rules

hanging man reversal strategy
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
MinHigherCloses 3 2 6 Higher closes in a row required before the hanging man.
HighLookback 10 5 30 The hanging man must be the highest of this many candles, itself included.
BodyZoneFrac 0.333 0.20 0.50 The body must sit inside this top fraction of the range (0.333 = top third).
MinWickBodyRatio 2.0 1.5 4.0 Minimum lower wick as a multiple of the body.
MaxUpperWickFrac 0.10 0.0 0.25 Maximum upper wick as a fraction of the range. 0.0 allows none.
StopBufferPoints 10 0 100 Points added above the hanging man's high for the stop. 0 puts it exactly at the high.
RiskReward 2.0 1.0 4.0 Take-profit distance as a multiple of the stop distance.
Lots 0.10 0.01 1.0 Fixed trade volume, adjusted to the broker's volume limits.

The MQL5 version also has a Magic input (default 726415). Give each running copy its own value.

hanging man reversal strategy — MQL5 source code

Recommended Chart Settings

This hanging man reversal strategy was designed for EUR/USD, GBP/USD and XAU/USD (gold) on the H1 or H4 timeframe. These are liquid markets with relatively tight spreads, and on those timeframes the wick-to-body proportions tend to be meaningful. The EA reads prices from whatever chart it is attached to, so it will run on other symbols too.

Points are not the same size on every instrument. On gold quoted to two decimals, 10 points is only 0.10 in price, so review StopBufferPoints for each symbol. Results will vary across market conditions: strong trends, quiet ranges and news-driven volatility all change how the pattern behaves.

How to Install on MetaTrader 5

To find the folder, choose File → Open Data Folder in MT5. To read or change the logic, compile HangingManReversal.mq5 in MetaEditor.

What to Consider Before Using This EA

Strengths

Limitations

Historically, a hanging man trading strategy tends to struggle in persistent uptrends with few pullbacks and in choppy ranges where new highs fade straight away.

Risk Management Tips

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog