Blog / Strategy
Strategy

Doji Extreme Reversal

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 Doji Extreme Reversal is a counter-trend, price-action expert advisor (EA) for MetaTrader 5 built around the doji candlestick — a candle whose open and close finish almost in the same place, producing little or no real "body." A doji is the market's clearest fingerprint of indecision: buyers and sellers fought to a draw for that bar. On its own a doji means very little, which is the key idea this strategy is designed to teach. Its meaning comes almost entirely from where it appears on the chart, not from the candle itself.

This EA looks for a doji that forms at a swing extreme — the highest high or lowest low of a recent window of candles — and then waits for the next candle to confirm a reversal before acting. In plain terms, a doji at the top of a recent up-push may indicate that buyers have run out of fuel exactly where they were strongest; a doji at the bottom of a down-push may indicate sellers stalled at the lows. The strategy never anticipates; it waits for the market to resolve the indecision and then trades that resolution. It also borrows the Average True Range (ATR) — a standard measure of recent volatility — but only as a filter and a stop-loss buffer, never to generate the signal itself.

As a learning tool, the Doji Extreme Reversal is well suited to traders who want to study exhaustion and mean-reversion behaviour: how markets behave at the edges of a move rather than in the middle of a trend. Because it is a counter-trend approach, it is best treated as an educational study in price-action geometry and confirmation logic — not as a "set and forget" system. Understanding why it enters, and just as importantly why it stays out, is the real value here.

How It Works

The strategy evaluates candles only once per freshly-closed bar, so it never reacts to a half-formed candle. It labels three candles: D (the doji candidate, two bars back), C (the confirmation candle that just closed, one bar back), and the window of bars that came before D. Here is what the strategy checks, step by step:

When all conditions line up, the strategy signals a trade in the direction of the rejection:

Framed simply: the strategy signals a reversal when a meaningful doji prints at a recent extreme and the very next candle closes back through it. It is a confirmation-based, wait-and-see approach rather than a predictive one.

doji reversal MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Lots 0.10 0.01 1.00 Order volume in lots. Controls position size; lower values reduce per-trade exposure.
SwingLookback 10 4 40 Number of bars before the doji used to define a swing high or low. Larger values demand a more significant extreme.
DojiBodyRatio 0.12 0.05 0.35 Maximum body-to-range ratio for a candle to qualify as a doji. Smaller values require a "purer," more balanced doji.
AtrPeriod 14 5 30 Lookback period for the ATR volatility filter and stop buffer.
AtrBuffer 0.25 0.00 1.50 ATR multiple added beyond the structural stop, giving the stop-loss extra room.
RiskReward 2.0 1.0 5.0 Reward-to-risk ratio. The take-profit distance is this multiple of the stop distance.
MinRangeAtr 0.50 0.00 2.00 Minimum doji range as an ATR multiple. Filters out dojis too small to be meaningful.
doji reversal MT5 EA — MQL5 source code

Recommended Chart Settings

The Doji Extreme Reversal was designed with XAU/USD (gold) or EUR/USD on the M15 (15-minute) timeframe in mind, though the logic is symbol- and timeframe-agnostic and can be studied on any liquid instrument. M15 offers a reasonable balance between signal frequency and noise for a pattern that depends on clean swing extremes. Keep in mind that results will vary considerably across different symbols, brokers, spreads, and market conditions — a setting that behaves one way during a calm range may behave very differently during high-volatility news periods. Always test on the exact symbol and timeframe you intend to study before drawing any conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Like every approach, the Doji Extreme Reversal has clear strengths and clear limitations, and an honest understanding of both is essential.

Strengths. The logic is transparent and purely price-action based — there are no opaque "black box" calculations. It only acts on confirmation (the candle after the doji must close back through the range), which helps filter out many false signals that catch traders who enter on the doji itself. The ATR-based size filter and stop buffer adapt to changing volatility rather than using a fixed pip distance, and the fixed reward-to-risk structure enforces a defined exit plan on every trade.

Limitations. This is a counter-trend strategy, and counter-trend trading is inherently challenging: a doji at a swing high in a powerful uptrend can simply be a pause before the trend continues, producing a losing reversal trade. The strategy may underperform in strong, sustained trends where extremes keep extending, and it can be whipsawed in choppy, low-volatility conditions where many small dojis appear. Because it trades one position at a time, it can also miss follow-on opportunities. No pattern — the doji included — has predictive certainty; location and confirmation improve the odds of a sensible read, but they do not remove risk. Treat this EA as a structured way to study reversal behaviour, not as a guarantee of any outcome.

Risk Management Tips

Sound risk management matters far more than any single signal. Consider these general principles as part of your education:

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