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 Pivot Reversion strategy is an intraday mean-reversion system built around the classic Camarilla pivot points — a set of price levels calculated once per day from the previous session's high, low, and close. Mean reversion is the idea that, on a typical range-bound day, price tends to drift back toward a central "fair value" after stretching too far in either direction. This strategy uses the Camarilla ladder to define exactly where "too far" is and where that central magnet sits.
Camarilla pivots produce a symmetrical ladder of levels above and below a central pivot (labelled H4/H3 above and L3/L4 below). The H3 and L3 rails are the reversal levels where price often stalls and turns on a normal, non-trending day, while the wider H4 and L4 rails mark the point at which the reversion idea is considered to have failed — a possible breakout day. The strategy watches for price to reach a reversal rail, reject it, and close back inside the band, then trades the bounce back toward the central pivot.
This EA is designed as a learning tool for traders who want to study how pivot-based reversion behaves in practice. It suits anyone curious about session-based level trading, non-repainting daily levels, and the discipline of structural take-profits paired with volatility-based stops. It is framed here as a strategy analysis — a way to understand a well-documented market behaviour — not as a profit opportunity.
How It Works
Each new calendar day, the strategy rebuilds its Camarilla ladder from the day that just closed and then holds those levels static for the whole session, so the levels never repaint. The previous day's OHLC is reconstructed directly from the primary-timeframe bars by detecting the calendar-day rollover, meaning the strategy stays single-timeframe compliant and never peeks at a higher chart.
The level math (where range = H − L of the prior day and f is the tunable range factor) is:
- P = (H + L + C) / 3 — the central pivot, used as the take-profit magnet
- H3 / L3 = C ± range × f / 4 — the reversal rails
- H4 / L4 = C ± range × f / 2 — the breakout / stop rails
The strategy signals a LONG when:
- The just-closed bar is bullish (closes above its open).
- The bar's low dips to (or slightly pierces) the L3 rail, within a small "touch zone."
- The bar closes back above L3 — so L3 held as support.
- The close is still below the central pivot P (room to revert upward) and above the L4 rail.
- Entry is at the Ask; the take-profit is the central pivot P; the stop-loss is placed just beyond the L4 rail (or below the signal bar's low, whichever is lower) minus an ATR buffer.
The strategy signals a SHORT when:
- The just-closed bar is bearish (closes below its open).
- The bar's high spikes to (or slightly pierces) the H3 rail, within the touch zone.
- The bar closes back below H3 — so H3 held as resistance.
- The close is still above the central pivot P (room to revert downward) and below the H4 rail.
- Entry is at the Bid; the take-profit is P; the stop-loss is placed just beyond the H4 rail (or above the signal bar's high, whichever is higher) plus an ATR buffer.
Exit and filter logic:
- Take-profit is always the structural central pivot P — the reversion target.
- Stop-loss uses the Average True Range (ATR), a volatility measure, to add a buffer beyond the failure rail, so stops sit past the level where the reversion thesis breaks.
- A minimum reward:risk filter rejects any setup where the distance to P is too small relative to the stop distance — if the magnet is too close, no trade is taken.
- Only one position per magic number is allowed at a time, and new entries are skipped when the current spread is wider than the configured maximum.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| RangeFactor | 1.10 | 0.80 | 1.40 | Camarilla range factor (textbook value 1.1). Widens or narrows the entire ladder of levels. |
| ZoneFrac | 0.08 | 0.01 | 0.30 | How close, as a fraction of the prior day's range, the candle's extreme must come to L3/H3 to count as a "touch." |
| AtrPeriod | 14 | 5 | 50 | ATR lookback period used to size the stop buffer beyond the L4/H4 rail. |
| StopBufferAtr | 0.60 | 0.00 | 3.00 | Stop buffer beyond the L4/H4 rail, expressed in ATR multiples. |
| MinRewardRisk | 0.80 | 0.30 | 3.00 | Minimum acceptable reward:risk ratio (distance to P divided by distance to stop). |
| MaxSpreadPoints | 100 | 5 | 300 | Skip new entries when the current spread (in points) is wider than this. |
| Lots | 0.10 | 0.01 | 1.00 | Order volume in lots. |
| Magic | 7731 | 0 | 9,999,999 | Expert magic number used to identify and manage this EA's positions. |

Recommended Chart Settings
This strategy was designed for a liquid FX major — such as EURUSD or GBPUSD — on the M15 (15-minute) timeframe. This is the textbook home of intraday Camarilla reversion, where daily ranges are well defined and price frequently oscillates inside the H3/L3 band. Because the strategy reconstructs the prior day's OHLC from the primary chart, you should run it on the timeframe you intend to test rather than switching between charts.
Keep in mind that results will vary considerably across different symbols, brokers, spreads, and market conditions. A pair or period that behaves in a range-bound way during one stretch may trend strongly in another, which directly affects how this reversion logic performs.
How to Install on MetaTrader 5
- Download the .ex5 file 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 the approach. The Camarilla ladder is computed once and frozen for the session, so the levels are non-repainting and easy to audit — what you see on the chart is what the strategy traded against. The logic is structurally clean: a clearly defined entry trigger, a structural take-profit at the central pivot, and a volatility-aware stop beyond the failure rail. The built-in reward:risk filter and spread guard add a layer of trade selectivity that many beginner systems lack.
Known limitations. Mean-reversion strategies are, by design, most comfortable on quiet, range-bound days and can struggle badly during strong trends or high-impact news. When a genuine breakout day occurs, price can blow straight through the H3/L3 rails and reach the H4/L4 stop rails, producing a losing trade — this is the inherent trade-off of any reversion approach. The strategy also takes only one position at a time per symbol, so it may sit idle during periods it deems unqualified. Because the take-profit is a fixed structural level rather than a trailing exit, favourable moves beyond the pivot are not captured.
Where it may underperform. Expect weaker behaviour during trending sessions, around major economic releases, at session opens with gaps, and on instruments or brokers with wide or erratic spreads. The MaxSpreadPoints filter helps, but no filter fully removes event risk. Treat this EA as a study of how pivot reversion behaves rather than a set-and-forget system.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles as you study this strategy:
- Position sizing: Size trades so that a single loss is a small fraction of your account, not a threat to it.
- The 1–2% rule: Many educators suggest risking no more than 1–2% of account equity on any one trade, so a string of losses does not cause severe damage.
- Use a demo account first: Test the EA thoroughly on a demo or simulation before ever considering live capital, so you understand its behaviour in different conditions.
- Understand drawdown: Every strategy experiences losing streaks. Know the historical drawdown you are comfortable enduring and how it feels in real time.
- Diversify and monitor: Avoid concentrating risk in a single instrument or leaving automated systems entirely unattended, especially around scheduled news events.
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: CamarillaPivotReversion.ex5 (1 downloads)
- Source Code: CamarillaPivotReversion.mq5 (1 downloads)
- Documentation: CamarillaPivotReversion.pdf (1 downloads)