Blog / Strategy
Strategy

Turning Point Density Breakout

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 Turning Point Density Breakout is a regime-gated breakout strategy built around a nonparametric randomness measure called the turning-point density, paired with a classic price breakout trigger. In plain terms, it counts how often recent closing prices reverse direction, uses that count to judge whether the market is genuinely trending or just chopping sideways, and only then looks for a breakout to trade in the direction the trend is already leaning. It is designed for the MetaTrader 5 platform and runs as an Expert Advisor (EA) on a single symbol and timeframe.

A "turning point" is a local peak or trough — a close that is higher than both of its neighbours (a peak) or lower than both (a trough). Statistical theory tells us that for a pure random walk, about two-thirds (≈0.667) of interior points will be turning points, because a directionless market constantly flips back and forth. When a market trends smoothly, consecutive closes push the same way and the turning-point density collapses well below that 0.667 baseline. The strategy treats a low density as the signature of a clean, low-noise directional regime — the kind of environment where a breakout is more likely to follow through than to trap traders.

This EA is best understood as a learning tool for studying regime detection and breakout confirmation, not as a shortcut to results. It is suitable for traders who want to explore how a simple statistical test can filter breakout signals, and who are comfortable studying, backtesting, and demo-testing an approach before ever considering live capital. If you are new to breakout systems or to the idea of filtering trades by market "regime," this strategy offers a compact, transparent example of both ideas working together.

How It Works

The strategy acts once per completed bar and combines a regime filter, a direction check, and a breakout trigger. All three must agree before it acts. Here is the logic step by step:

For managing trades already open, the logic is deliberately conservative:

turning point density breakout EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Window 22 10 60 Number of recent closes over which the turning-point density is measured. Larger values smooth the regime read; smaller values react faster.
MaxDensity 0.45 0.25 0.62 Density threshold for a trending regime. A trade is allowed only when density is at or below this. 0.667 is the random-walk baseline, so values below it demand a genuinely smooth, low-reversal tape.
BreakoutBars 10 4 30 Number of prior bars whose highest high or lowest low the trigger bar must clear to confirm a breakout.
AtrPeriod 14 7 30 Lookback period for the ATR used to size the stop-loss.
AtrStopMult 2.0 1.0 4.0 Stop-loss distance expressed as a multiple of ATR. Higher values give the trade more room but risk more per trade.
RewardRatio 1.8 1.0 3.0 Take-profit distance as a reward-to-risk multiple of the stop distance.
Lots 0.10 0.01 1.0 Fixed order volume in lots for each entry.
turning point density breakout EA — MQL5 source code

Recommended Chart Settings

The Turning Point Density Breakout was designed to operate on a single symbol and a single timeframe — every calculation uses the chart's own timeframe. A common starting point for studying breakout systems like this is a major forex pair such as EUR/USD on an intraday timeframe like the H1 (1-hour) chart, where there is enough bar structure for the density and breakout windows to be meaningful without excessive noise.

That said, the "best" symbol and timeframe are something you should establish for yourself through testing rather than assume. Turning-point density and breakout behaviour differ substantially between fast-moving pairs, ranging pairs, and different session hours. Results will vary across instruments, timeframes, and market conditions, so treat any default as a research starting point, not a recommendation.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every strategy has trade-offs, and being honest about them is part of using one responsibly.

Strengths. The regime filter is the distinctive idea here. By requiring the turning-point density to fall below a threshold before any breakout is taken, the strategy tries to avoid the classic failure mode of breakout systems — being whipsawed inside a choppy range. The turning-point test is nonparametric, meaning it makes no assumption about the distribution of returns, which is appealing for messy real-world price data. The logic is also symmetric and transparent: long and short rules mirror each other, and every decision is explainable.

Known limitations. Breakout strategies as a family tend to produce many small losing trades punctuated by occasional larger winners; the reward-to-risk target is built around that reality, but it also means win rates can feel low even when the approach is behaving as designed. The turning-point density is a lagging measure — by the time a trend is smooth enough to register, part of the move may already be spent. The strategy can also flip in and out of positions when signals reverse, which may increase transaction costs from spread and commission.

Where it may underperform. In violently choppy or news-driven markets, false breakouts can still slip through even when the density filter is engaged. In very slow, tightly ranging conditions, the density may rarely drop below the threshold, so the EA may sit idle for long stretches. And in sharply mean-reverting markets, a confirmed breakout can reverse quickly, hitting the ATR stop. None of these are flaws in the code — they are simply the market conditions this style of system finds difficult.

Risk Management Tips

Regardless of the strategy, disciplined risk management matters more than any single parameter setting. Consider these general principles as you study this EA:

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