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 Engulfing Fade Hedge is a pure price-action reversal scalper for MetaTrader 5 that combines two classic techniques: floor-trader pivot levels and the engulfing candlestick pattern. A "pivot level" is a support or resistance price calculated arithmetically from a recent high, low, and close, while an "engulfing candle" is a two-bar reversal pattern where the most recent candle's body completely covers the previous candle's body. The strategy uses no moving averages, oscillators, or other lagging indicators — every decision is derived directly from raw bar data.
This is a counter-trend, or "fade," approach. Rather than chasing momentum, the strategy waits for price to stretch into a calculated resistance zone (the R1 band) and fade a rally when a bearish engulfing candle appears, or to dip into a calculated support zone (the S1 band) and fade the dip when a bullish engulfing candle appears. The design assumes that short-term overextensions toward pivot levels often pause or reverse — a behavior that historically shows up most clearly in ranging or mean-reverting market conditions.
As a learning tool, the Pivot Engulfing Fade Hedge is well suited to traders who want to study how structure-based stops, fixed reward-to-risk targets, and a defensive hedging mechanism fit together in a single rules-based system. Because it is fully mechanical and indicator-free, it is a clear example of how price-action logic can be expressed in code. It should be approached as a framework for analysis and study, not as a profit opportunity.
How It Works
The strategy evaluates a fresh entry only when a new bar completes, and it manages any open hedge on every incoming tick. Here is the logic in plain English:
- Building the pivots: On each completed bar, the strategy scans the most recent
PivotLookbackbars to find the highest high and lowest low. It then computes the classic floor-trader pivot pointPP = (High + Low + Close) / 3, the first resistanceR1 = 2 × PP − Low, and the first supportS1 = 2 × PP − High. - Defining the proximity band: A "band" equal to
ProximityPct × range(where range is the high-low span over the lookback) sets how close price must come to a pivot to count as being "at" it. This avoids requiring an exact touch. - Buy signal (fading a dip): The strategy signals a long entry when the newest completed bar is a bullish engulfing candle and its low has reached down into the S1 support band. The idea is that selling pressure into support has been rejected.
- Sell signal (fading a rally): The strategy signals a short entry when the newest completed bar is a bearish engulfing candle and its high has reached up into the R1 resistance band, suggesting buying pressure into resistance has stalled.
- Stop-loss logic: Each entry uses a structure-based stop placed just beyond the engulfing candle's extreme, padded by a buffer equal to
0.10 × range. For a buy, the stop sits below the signal candle's low; for a sell, above its high. - Take-profit logic: The take-profit is set at a fixed multiple of the stop distance using the
RewardRiskRatio. With the default of 1.5, the target is 1.5 times the risk distance away from entry. - The hedge mechanism: If price keeps moving against the primary position past a configurable fraction of the stop distance (
HedgeTriggerPct), the strategy opens one opposite "hedge" leg sized atLots × HedgeMultiplier. This leg is designed to cap further drawdown and harvest the continuation if the move keeps running. Only one hedge is placed per cycle. - Cycle reset: Once no positions remain open for the strategy's magic number, the hedge flag resets and the system is ready to evaluate the next signal.
This combination means the strategy always knows its risk before entering, and it has a defined defensive response if the market moves strongly against the original read.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| PivotLookback | 20 | 5 | 60 | Number of recent completed bars used to compute the rolling high, low, and the floor-trader pivot levels (PP / R1 / S1). |
| ProximityPct | 0.20 | 0.05 | 0.60 | Fraction of the lookback range that defines the proximity band — how close price must be to R1 or S1 to qualify as "at" the pivot. |
| RewardRiskRatio | 1.5 | 0.5 | 3.0 | Multiple of the stop distance used to set the take-profit target relative to the entry. |
| HedgeTriggerPct | 0.60 | 0.30 | 0.95 | Fraction of the stop distance the primary trade must move against you before the opposite hedge leg is opened. |
| HedgeMultiplier | 1.5 | 1.0 | 3.0 | Volume multiplier applied to the base lot size when opening the hedge leg. |
| Lots | 0.10 | 0.01 | 1.0 | Base trade volume in lots for the primary position. |

Recommended Chart Settings
The Pivot Engulfing Fade Hedge is built as a price-action scalper, so it is designed for liquid instruments on intraday timeframes — for example, major forex pairs such as EUR/USD on the M15 or M5 chart, where engulfing patterns near pivot bands form frequently. Because the pivots are recalculated on a rolling basis from recent bars rather than fixed daily levels, the strategy adapts to the timeframe you attach it to.
That said, every market behaves differently. The fade logic historically performs best in ranging or mean-reverting conditions and may struggle in strong, persistent trends. Always test the strategy across multiple symbols, timeframes, and market regimes in the MT5 Strategy Tester before drawing any conclusions, and remember that results will vary across different market conditions.
How to Install on MetaTrader 5
- Download the
.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
Every strategy involves trade-offs, and a balanced view helps you study this one effectively.
Strengths. The approach is transparent and fully rules-based, with no indicator lag — entries derive directly from price structure. Risk is defined before entry through a structure-based stop, and the fixed reward-to-risk target removes discretionary exit guesswork. The hedge mechanism adds a defensive layer that can limit how far a single losing cycle runs.
Known limitations. Counter-trend fading is inherently challenging: by definition you are trading against the immediate move, so a strong trend can push through both the pivot band and your stop. Engulfing patterns are common, which can produce frequent signals — some of which will be noise rather than genuine reversals. The hedge is a double-edged tool: while it can cap drawdown and capture continuation, opening a larger opposite leg increases total exposure and can compound losses if price whipsaws around the entry. Scalping strategies are also sensitive to spread, slippage, and commission, which can meaningfully erode results on lower timeframes.
Conditions where it may underperform. Trending markets, high-impact news events, and illiquid sessions with wide spreads are the most likely environments for this fade approach to give back gains. Treat the hedge multiplier and trigger settings with particular care, since they directly affect how much additional risk the strategy can take on.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles as you study the strategy:
- Risk a small, fixed percentage per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position. Size your
Lotsparameter accordingly, and remember the hedge leg adds to total exposure. - Start on a demo account. Run the EA in a risk-free demo environment first so you can observe how it behaves across different sessions without committing real capital.
- Understand drawdown. Review the maximum drawdown in the Strategy Tester and ask whether you could tolerate that decline emotionally and financially in live conditions.
- Account for trading costs. Factor in spread, commission, and slippage, which are especially significant for a scalping strategy on intraday timeframes.
- Avoid over-optimization. Parameters that look ideal on past data may not hold up going forward. Favor robust, stable settings over curve-fitted ones.
- Never risk money you cannot afford to lose. Treat all results — including backtests — as study material, not assurances of future outcomes.
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: PivotEngulfingFadeHedge.ex5 (3 downloads)
- Source Code: PivotEngulfingFadeHedge.mq5 (4 downloads)
- Documentation: PivotEngulfingFadeHedge.pdf (4 downloads)