Blog / Strategy
Strategy

Pivot Breakout Engulfing 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?

The Pivot Breakout Engulfing Hedge is a pure price-action expert advisor (EA) for MetaTrader 5 that combines three classic technical tools: floor pivot points (the R1 resistance and S1 support levels intraday desks watch closely), the engulfing candlestick pattern (a momentum candle whose body completely covers the previous candle's body), and a managed hedging mechanism. It uses no lagging indicators — no moving averages, RSI, ATR, Bollinger Bands, or VWAP — which makes it a clean case study in how raw candle structure and horizontal levels can be turned into a rules-based trading system.

The strategy is built for a specific market condition: liquid, breakout-prone instruments where price repeatedly tests pivot levels and then either breaks through with conviction or fakes out and snaps back. In plain terms, it is designed for the constant tug-of-war that happens at resistance and support. A naive breakout trader wins when a level breaks cleanly but gets repeatedly stopped out by "stop-hunt" fakeouts. This system attempts to address the second case directly by deploying an opposite hedge leg when a breakout fails, rather than simply absorbing the loss.

As a learning tool, the Pivot Breakout Engulfing Hedge is best suited to traders who already understand candlestick patterns and pivot mathematics and who want to study how breakout logic, false-break detection, and basket-level money management can be coded together. It is an intermediate-to-advanced example — the hedging component in particular requires careful study. It should be treated as an educational framework for understanding price-action automation, not as a shortcut to results.

How It Works

The strategy recalculates its levels on every closed bar and only looks for new trades when it is completely flat. Here is the logic step by step.

Level calculation (the foundation):

Entry conditions (the strategy signals a trade when, while flat):

Stop-loss and take-profit on the base leg:

The hedge (the signature mechanic):

Basket exit (the dominant exit while any position is open):

pivot breakout engulfing hedge EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
PivotLookback 24 5 150 Number of closed bars whose high/low/close define the floor pivots.
BreakFrac 0.03 0.00 0.50 How far beyond R1/S1 the candle must close to confirm a break (fraction of pivot range).
BodyFrac 0.55 0.20 0.95 Minimum breakout body as a fraction of its full range — filters weak, wicky breaks.
FalseBreakFrac 0.25 0.05 1.00 Distance back inside the broken level that confirms the break failed and triggers the hedge.
StopFrac 0.40 0.05 2.00 Extra base-stop pad placed beyond the hedge trigger (fraction of range).
RewardFrac 1.00 0.20 4.00 Measured-move reward for the breakout/hedge target (fraction of range).
ReclaimFrac 0.40 0.05 1.50 Hedge invalidation pad — if the broken level is reclaimed by this much, the hedge is wrong.
HedgeMult 1.50 0.50 3.00 Hedge volume multiplier (hedge lots = Lots × HedgeMult).
BasketTpMoney 25.0 5.0 2000.0 Close the whole basket once net floating profit reaches this (account currency).
BasketSlMoney 300.0 50.0 100000.0 Flatten the whole basket once net floating loss reaches this (account currency).
MaxSpreadPoints 50 0 500 Skip new entries while spread (points) exceeds this (0 = off).
Lots 0.10 0.01 1.00 Base leg trade volume in lots.
Magic 5310 0 9,999,999 Magic number used to identify this EA's positions.
pivot breakout engulfing hedge EA — MQL5 source code

Recommended Chart Settings

The Pivot Breakout Engulfing Hedge was designed for liquid, breakout-prone instruments such as GBP/USD, USD/JPY, or XAU/USD (gold) on the M5 or M15 timeframes, where pivot breaks and stop-hunt fakeouts alternate frequently. The pivot range automatically scales every buffer and target, so the EA can technically run on any symbol or timeframe selected at backtest time.

That flexibility is a double-edged sword: the same settings that work on one instrument may behave very differently on another. Results will vary across symbols, brokers, spreads, and market conditions, so any timeframe or symbol you choose should be studied carefully on its own before being considered.

Important: Because this EA opens simultaneous opposing legs (a true hedge), it requires a hedging account. On a netting account the two legs would net out and the hedge logic would not function as intended.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Like any strategy, the Pivot Breakout Engulfing Hedge has clear strengths and equally clear limitations, and it is worth weighing both honestly.

Strengths:

Limitations to understand:

The honest takeaway is that this EA is a sophisticated educational example of combining pattern recognition with hedged risk control — not a set-and-forget solution. It rewards study and careful testing.

Risk Management Tips

Sound risk management matters far more than any single entry signal. As you study this strategy, keep these general principles in mind:

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