Blog / Strategy
Strategy

Range Straddle Hedge

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?

Range Straddle Hedge is a pure price-action expert advisor (EA) for MetaTrader 5 that uses no technical indicators at all — no moving averages, no RSI, no ATR, no pivots, and no chart patterns. Instead, it reads raw bar highs and lows to measure a consolidation range, then "straddles" that range with a mirror-image pair of pending stop orders. Its trading style is breakout hedging: it tries to capture genuine breakouts while using a deliberately retained hedge order to recover from false ones.

The strategy is designed for range-bound, choppy markets — the kind of sideways conditions where price repeatedly pokes above resistance or below support and then snaps back. These "false breakout" whipsaws are the natural enemy of a simple breakout system, which gets stopped out on the first move and then stopped out again on the reverse. Range Straddle Hedge approaches this problem differently: it keeps the opposite resting order alive as a hedge rather than cancelling it, so that a reversal across the range can be captured by the second leg.

As a learning tool, this EA is best suited to traders who want to study basket money management and hedging mechanics — how multiple open positions can be managed as a single book, and how floating profit and loss across legs can be netted to a target. It is not a "set and forget" money machine, and it is not a beginner's first EA. Treat it as a structured example of how a hand-managed hedge book can be expressed in code.

How It Works

Range Straddle Hedge operates as a simple state machine that runs on a single timeframe and moves between three phases: Idle, Armed, and Engaged. Here is what the strategy signals at each step:

Stop-loss logic (per leg): Each leg carries a wide catastrophic stop-loss set at StopMult range-widths against the trade. This stop is intentionally placed wider than the opposite boundary, so that the hedge order fills first and the two legs can coexist rather than stop-and-reverse. It exists mainly as a hard ceiling so no single leg can live indefinitely.

Take-profit logic (per leg): Each leg also carries a fixed take-profit at RewardRatio range-widths in the trade's favour. This is what banks a clean, running breakout.

The dominant exit — basket money management: Above the per-leg orders sits a basket layer that runs on every tick whenever positions are open. It sums the floating profit and loss (including swap) across all open legs:

A spread filter (MaxSpreadPoints) can also be enabled to skip placing a straddle when the spread is unusually wide.

range straddle hedge EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
RangeLookback 20 5 120 Number of closed bars whose highest high and lowest low define the consolidation range.
BufferFrac 0.10 0.00 1.00 Breakout offset placed beyond each range boundary, expressed as a fraction of the range width.
RewardRatio 2.00 0.50 6.00 Per-leg take-profit distance, as a multiple of the range width.
StopMult 3.00 1.00 10.00 Per-leg catastrophic stop-loss distance, as a multiple of the range width.
BasketTpMoney 30.0 5.0 2000.0 Close the whole basket once floating profit reaches this amount (account currency).
BasketSlMoney 400.0 50.0 100000.0 Flatten the whole basket once floating loss reaches this amount (account currency).
ExpiryBars 8 1 100 Cancel an untriggered straddle after this many bars, then re-measure the range.
MaxSpreadPoints 50 0 500 Skip placing a straddle while the spread (in points) is wider than this (0 = filter off).
Lots 0.10 0.01 1.00 Trade volume, in lots, used for each leg.
Magic 5210 0 9,999,999 Unique identifier so the EA manages only its own orders and positions.
range straddle hedge EA — MQL5 source code

Recommended Chart Settings

Range Straddle Hedge was designed for a liquid, range-prone FX major such as EURUSD or AUDUSD, on the M15 or M30 timeframe. These conditions are the natural habitat of the false-breakout whipsaws the hedge is meant to recover. Because every distance the EA uses is derived from the measured range width, the logic adapts to different symbols and timeframes automatically — but that does not mean every market suits it equally. Results will vary across instruments, sessions, and volatility regimes, and a setting that historically worked on one pair may behave very differently on another.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of this approach. The clearest strength is conceptual: by retaining the opposite order as a hedge, the strategy can turn a classic whipsaw — where a naive breakout system would take two consecutive losses — into a scratch or a small win. The basket exit is responsive, banking recovered moves quickly, and because everything is measured in range-widths, the system scales cleanly across symbols without hard-coded pip values. Being indicator-free, it also has no lag from smoothing or repainting.

Known limitations. Hedging is not a free lunch. The well-documented failure mode is a strong, sustained one-way trend that begins right after the hedge locks in: both legs can drift against the basket until BasketSlMoney is hit, producing a single larger loss that may exceed several small wins. Holding two legs also means paying spread and potentially swap on both, and on hedging-restricted account types (including many under certain regulators) the locked long-and-short structure may not be permitted at all. Frequent re-straddling can increase transaction costs in very quiet markets.

Where it may underperform. Trending markets, news-driven gaps, and instruments with wide or unstable spreads are the conditions where this design tends to struggle. The MaxSpreadPoints filter helps with the spread problem, but it cannot anticipate a breakout that simply keeps going. Always study how the EA behaves across a range of market conditions before considering it on a live account.

Risk Management Tips

Sound risk management matters more than any single strategy. 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