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 Directional Change Overshoot strategy is an event-driven momentum system for MetaTrader 5 built on the Directional Change (DC) framework — a technique borrowed from high-frequency finance research (Guillaume, Dacorogna, Olsen and colleagues). Instead of acting on a fixed calendar-bar clock, it reacts to price events of a chosen magnitude, a concept often called "intrinsic time." A directional change is a confirmed reversal of a set percentage away from the most recent price extreme, and this Expert Advisor (EA) trades in the direction of each confirmed change to capture the "overshoot" leg that typically follows.
In plain terms, a directional change occurs when the market, after climbing to a running high (or falling to a running low), pulls back by a threshold percentage — signalling that the prior run has flipped. The empirical regularity the strategy leans on is that the average overshoot after a directional change is roughly the same size as the threshold that triggered it. The EA therefore enters in the new direction to study whether that overshoot materialises: a confirmed downturn produces a short, and a confirmed upturn produces a long.
This strategy is best viewed as a learning tool for traders who want to understand event-based (as opposed to time-based) trading logic, threshold-driven trend detection, and stop-and-reverse position management. It suits an intermediate student of algorithmic trading who is comfortable with concepts like ATR-scaled risk and wants to see how a research-grade market microstructure idea translates into a working MT5 EA. It is not a shortcut of any kind — it is a framework for structured experimentation on a demo account.
How It Works
The strategy runs a small state machine that classifies the market as being in an "up run" or a "down run," then watches for the threshold reversal that confirms a directional change. All price reads use the chart's own timeframe, so the "clock" bar is whatever timeframe you apply at test time — but the DC events are what actually drive the trades.
- Threshold definition: The threshold, called theta, is set as a percentage of price (
ThresholdPercent). Because it is a fraction of price rather than a fixed pip amount, the same logic adapts across instruments of different prices. - Up run (hunting a downturn): While the market makes new highs, the EA extends its running high. When a bar closes theta below that running high, a downturn directional change is confirmed and the strategy signals a short to ride the expected down overshoot.
- Down run (hunting an upturn): While the market makes new lows, the EA extends its running low. When a bar closes theta above that running low, an upturn directional change is confirmed and the strategy signals a long to ride the expected up overshoot.
- Strict alternation: Directional changes alternate up and down by construction, which is why the system is naturally stop-and-reverse. If
ReverseOnSignalis enabled, an opposite DC while a trade is open closes that position and opens the new one; if disabled, the EA only enters when it is flat. - New-bar handling: The EA acts once per completed bar. It reads the just-closed bar (shift 1) and updates its state only when a new bar forms, avoiding repeated intrabar signals.
- Stop-loss logic: On entry, the strategy computes the Average True Range (ATR) — a volatility measure — over
AtrPeriodbars. The stop distance isAtrStopMult × ATR. A long places its stop that distance below entry; a short places it that distance above. This scales protection to current volatility. - Take-profit logic: The target is set at
RewardRiskRatio × stop distancefrom entry, so a value of 1.5 aims for a reward one and a half times the risked distance. The ATR-based stop and target exist to protect a trade if the anticipated overshoot stalls before the next directional-change event arrives.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ThresholdPercent | 0.35 | 0.05 | 2.00 | The directional-change threshold (theta) as a percent of price. Larger values produce fewer, bigger events; smaller values react to minor swings. |
| AtrPeriod | 14 | 5 | 40 | Number of bars used to calculate the ATR that sizes the protective stop and target. |
| AtrStopMult | 2.0 | 0.5 | 5.0 | Stop-loss distance expressed as a multiple of ATR from the entry price. |
| RewardRiskRatio | 1.5 | 0.5 | 4.0 | Take-profit distance as a reward-to-risk multiple of the stop distance. |
| ReverseOnSignal | 1 | 0 | 1 | 1 = flip the position on an opposite DC event (stop-and-reverse); 0 = only enter when flat. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed order volume in lots for each trade. |
(The EA also exposes a Magic number input, default 3417, used internally to tag and manage its own positions.)

Recommended Chart Settings
The Directional Change Overshoot EA is single-timeframe and instrument-agnostic by design — because the threshold is a percentage of price, the same rules can be applied across forex pairs, indices, or other CFDs. A common starting point for study is a major FX pair such as EUR/USD on the H1 (1-hour) timeframe, which offers a balance between event frequency and noise. Higher timeframes produce fewer, larger directional changes; lower timeframes produce more frequent, noisier events.
Because the "clock" bar is whatever timeframe you attach the EA to, the choice of timeframe interacts directly with ThresholdPercent. It is worth testing several combinations in the Strategy Tester. Remember that results will vary considerably across different symbols, spreads, and market conditions, so treat any single configuration as a hypothesis to examine rather than a fixed setting.
How to Install on MetaTrader 5
- Download the
DirectionalChangeOvershoot.ex5file from the link below. - Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or refresh the Navigator panel.
- Drag the EA onto a chart matching the recommended symbol and timeframe.
- Configure the input parameters and enable Algo Trading.
What to Consider Before Using This EA
Like every approach, the Directional Change Overshoot strategy has clear strengths and equally clear limitations, and understanding both is the point of studying it.
Strengths. The DC framework is grounded in published market-microstructure research and offers an intuitive, self-adjusting definition of trend that does not depend on lagging moving averages. Measuring the threshold as a percentage of price makes the logic portable across instruments. The stop-and-reverse design keeps the EA continuously engaged with the dominant swing, and ATR-scaled risk means protective levels adapt to changing volatility rather than using fixed distances.
Limitations. The strategy assumes the historical regularity that overshoots tend to match the DC threshold; in practice, this is an average tendency and any individual overshoot may be smaller, larger, or absent. In choppy, range-bound markets the threshold can trigger repeatedly with little follow-through, producing a series of small losses often described as "whipsaw." Because the EA acts on bar closes rather than ticks, entries occur after the reversal is confirmed, which can mean giving up part of the move. A stop-and-reverse system may also underperform during sharp, one-directional trends that never generate the opposite event needed to exit near the extreme.
Where it may underperform. Low-volatility drift, wide-spread instruments, and news-driven gaps can all degrade the strategy's behaviour. The percentage threshold that suits one symbol may be far too sensitive or too coarse for another, so parameter choices are not universal.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Whatever configuration you study, keep these general principles in mind:
- Position sizing: Size trades so that a full stop-loss represents only a small fraction of your account. A widely cited guideline is to risk no more than 1–2% of account equity per trade, and the fixed
Lotsinput should be chosen with that in mind. - Test on a demo account first: Run the EA on a demo or simulation account for an extended period before committing any real capital, so you can observe its behaviour across varied conditions.
- Understand drawdown: Every strategy experiences losing streaks. Review the maximum drawdown in your testing and ask yourself whether you could tolerate that decline in practice.
- Use the Strategy Tester: Backtest and forward-test across multiple symbols, timeframes, and spread assumptions before drawing conclusions, and remember that in-sample results can flatter a strategy.
- Never over-leverage: Leverage amplifies losses as readily as gains. Keep exposure conservative, especially while you are still learning how the DC events behave.
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
- Expert Advisor: DirectionalChangeOvershoot.ex5 (38 downloads)
- Source Code: DirectionalChangeOvershoot.mq5 (35 downloads)
- Documentation: DirectionalChangeOvershoot.pdf (58 downloads)