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 Camarilla Edge Reversal Hedge is a pure price-action expert advisor (EA) for MetaTrader 5 that combines Camarilla pivot points — a family of intraday support and resistance levels calculated from a rolling high, low, and close — with the classic bullish and bearish engulfing candlestick pattern. It uses no traditional indicators at all: no moving averages, no RSI, no ATR, and no VWAP. Every line it reacts to is derived directly from recent price, which makes the logic transparent and easy to study line by line.
What makes this strategy distinctive is that it blends three well-known trading "edges" into a single framework: a mean-reversion fade at the pivot band edges, a momentum breakout when price closes beyond the extreme bands, and a hedging recovery layer that can hold opposing long and short positions during the transition between those two states. It is designed for ranging-to-trending intraday conditions on liquid markets, where Camarilla pivots have traditionally been used by short-term traders to anchor reversal and breakout decisions.
As a learning tool, this EA is best suited to traders who already understand basic candlestick reading and want to study how pivot-based levels, pattern confirmation, and risk-defined order placement fit together in code. It is not a "set and forget" product — it is a worked example of how multiple classic concepts can be expressed mechanically. Because it can open hedged (simultaneous long and short) positions, it also serves as a practical illustration of how hedging accounts behave differently from netting accounts.
How It Works
The strategy evaluates its rules once per newly-closed bar on the chart timeframe, so signals do not flicker or repaint mid-candle. On each closed bar it rebuilds the Camarilla ladder from the previous Lookback bars:
- Range (R) = highest high minus lowest low over the lookback window.
- Unit = R × 1.1 ÷ 4 (the standard Camarilla spacing factor).
- H3 / H4 = the most recent close plus one and two units (upper "fade" and "breakout" lines).
- L3 / L4 = the most recent close minus one and two units (lower fade and breakout lines).
- Central Pivot (P) = (high + low + close) ÷ 3 — the reversion magnet that fade trades target.
It then checks for an engulfing pattern on the last two completed bars. A bullish engulfing is an up-bar that fully engulfs the prior down-bar's body; a bearish engulfing is the mirror image. With the ladder and the pattern in hand, the strategy signals one of three behaviours:
1. Engulfing Reversal (fade the band edge back toward P)
- The strategy signals a short when the just-closed bar pokes its high up to or through H3 but still closes below H4 (stretched into the upper band, not broken out), stays above the central pivot, and forms a bearish engulfing. The target is the central pivot P; the stop sits just beyond H4.
- It signals a long under the mirror conditions at the lower band: the bar dips to or through L3, closes above L4, stays below P, and forms a bullish engulfing. Target is P; stop sits beyond L4.
2. Breakout (ride momentum through the extreme band)
- The strategy signals a buy when a bar closes beyond H4 — interpreted as an upside breakout. The stop is placed back at H3 minus a buffer, and the take-profit is projected one fraction of R beyond H4.
- It signals a sell when a bar closes beyond L4, using the mirror-image stop and target.
3. Hedge (the recovery layer)
- When
HedgeModeis enabled, a breakout entry is allowed to open even while an opposite reversal trade is still live. For example, a fade-short that is caught wrong by a genuine break of H4 is met by a breakout-buy that opens alongside it. The book is briefly hedged long and short: the runaway leg is covered by the new breakout leg while the original reversal is capped by its own stop. This is intended to net out directional risk during the transition rather than absorbing the full adverse move.
Stop-loss and take-profit logic. Every distance — the touch zone, the stop buffer, and the breakout projection — is scaled by the range R, so the strategy adapts to any symbol or volatility level without hard-coded point sizes. Before any order is sent, a minimum reward:risk filter rejects setups whose target is too cramped relative to the stop. A spread filter also blocks new entries when the current spread is wider than the allowed maximum, which helps avoid entering during illiquid or news-driven conditions.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Lookback | 20 | 5 | 100 | Number of completed bars whose high/low/close build the Camarilla bands. |
| StopBufferFrac | 0.10 | 0.02 | 0.50 | Stop buffer beyond the H4/L4 (reversal) or H3/L3 (breakout) line, as a fraction of the lookback range R. |
| BreakoutProjFrac | 0.50 | 0.10 | 2.00 | Breakout take-profit projection beyond H4/L4, as a fraction of R. |
| MinRewardRisk | 0.80 | 0.30 | 3.00 | Minimum acceptable reward:risk ratio for any new entry. |
| HedgeMode | 1 | 0 | 1 | 1 = allow a breakout leg to open while the opposite reversal leg is still live (true simultaneous hedge); 0 = only ever one position at a time. |
| MaxSpreadPoints | 80 | 0 | 400 | Skip new entries when the current spread (in points) is wider than this value. |
| Lots | 0.10 | 0.01 | 1.00 | Base lot size, normalised to the symbol's volume step and limits. |
| Magic | 7401 | 0 | 9,999,999 | Magic number used to identify and manage this EA's own trades. |

Recommended Chart Settings
This strategy was designed with liquid FX majors in mind — EURUSD is the natural home of Camarilla pivot scalping — on the M5 or M15 timeframe. These shorter intraday charts are where pivot bands and engulfing confirmations are traditionally applied, and where the range-scaled distances tend to be most meaningful.
Because HedgeMode can open simultaneous long and short positions, you should run this EA on a hedging account if you want that behaviour to work as intended. On a netting account, opposite orders simply offset each other and the two role tickets collapse into one position. As always, results will vary considerably across different symbols, brokers, spreads, and market conditions, so treat the recommended settings as a starting point for study rather than a fixed prescription.
How to Install on MetaTrader 5
- Download the
CamarillaEdgeReversalHedge.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
Strengths of this approach. Because the strategy is pure price action, its logic is fully transparent — there are no lagging indicator calculations to obscure why a trade fired. Camarilla pivots are a long-established intraday framework, and pairing them with an engulfing confirmation adds a pattern filter that historically helps avoid trading every minor touch of a level. The fact that all distances are scaled by the range R means the same settings can adapt across instruments of different volatility, and the built-in reward:risk and spread filters add a layer of discipline that many discretionary approaches lack.
Known limitations. Pivot-reversal systems can struggle in strongly trending markets, where price runs straight through the H3/L3 fade lines without rejecting — exactly the scenario the hedge layer attempts to manage, but hedging is a risk-transfer mechanism, not a guarantee of recovery. Engulfing patterns are common and not all of them lead to follow-through, so false signals are an inherent part of any pattern-based system. The hedge logic also assumes a hedging-capable account; on a netting account it behaves quite differently. Finally, breakout entries placed on a close beyond an extreme band may experience slippage during fast moves, and the spread filter only blocks new entries — it does not protect open positions.
Where it may underperform. Choppy, low-volatility sessions can produce small ranges where the bands sit close together and the reward:risk filter rejects most setups, leading to few or no trades. Conversely, violent news-driven moves can blow through both the fade stop and the breakout target faster than the per-bar logic can react. Studying these edge cases on a demo account is the most valuable way to understand the strategy's behaviour.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study any automated strategy:
- Position sizing: Keep your
Lotssetting appropriate for your account size. A lot size that is comfortable on a large account can be dangerous on a small one, especially when the hedge layer may hold two positions at once. - Risk per trade: Many educators suggest risking no more than 1–2% of account equity on a single trade. Because stops here are scaled by range, the actual currency risk changes with volatility — check it before trading.
- Use a demo account first: Run the EA on a demo account across a range of market conditions before considering any live use. This is the safest way to learn how it behaves.
- Understand drawdown: Every strategy experiences losing streaks. Know the maximum drawdown you are willing to tolerate, and understand that hedged positions can still accumulate combined losses if both legs move against you.
- Account type awareness: Confirm whether your account is hedging or netting, since this fundamentally changes how the EA's positions are managed.
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: CamarillaEdgeReversalHedge.ex5 (5 downloads)
- Source Code: CamarillaEdgeReversalHedge.mq5 (5 downloads)
- Documentation: CamarillaEdgeReversalHedge.pdf (4 downloads)