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 Engulfing Pivot Scalp Hedge is a pure price-action expert advisor (EA) for MetaTrader 5 that combines three classic intraday tools — floor pivot points, engulfing candlestick patterns, and a pivot breakout entry — with a managed stop-and-reverse hedge mechanic. Notably, it uses no traditional indicators at all: there is no moving average, RSI, ATR, or Bollinger Band anywhere in its logic. Every decision is derived directly from raw candle highs, lows, opens, and closes.
A pivot point is a reference level that many intraday desks mark each session, calculated from the prior period's high, low, and close. An engulfing candle is a two-bar reversal pattern where the most recent candle's body completely covers (or "engulfs") the previous candle's body, which traders read as a shift in short-term conviction. This strategy fuses the two: it watches for a decisive close through the first resistance (R1) or first support (S1) pivot, but only treats that break as real when the breakout bar is also a true engulfing candle.
This EA is designed for liquid, breakout-prone instruments such as major FX pairs (GBP/USD, EUR/USD) or gold (XAU/USD) on intraday timeframes like M5, M15, or M30 — markets where pivot breaks and false breaks alternate throughout the trading day. As a learning tool, it is best suited to traders who want to study how breakout confirmation, candlestick filtering, and basket-based hedging interact in a single rules-based system. It is presented here as a strategy analysis, not a profit opportunity.
How It Works
The strategy recomputes its pivot levels on every closed bar and only hunts for new trades when it is completely flat. Here is the logic in plain English:
- Building the pivots. Over the most recent
PivotLookbackclosed bars before the signal candle, the strategy records the highest high (H), the lowest low (L), and the last close (C) of that block. It then derives the classic floor pivots: PP = (H + L + C) / 3, R1 = 2 × PP − L, and S1 = 2 × PP − H. The pivot range (H − L) is used to size every buffer and target, so all distances scale automatically to any symbol or timeframe without hard-coded pip values.
- Long entry signal. The strategy signals a long when the just-closed candle is a bullish engulfing (its body fully covers the prior bearish body, and the current body is at least
EngulfFactortimes the prior body) and it closes cleanly above R1 — having come up from at or below that level. This is read as resistance giving way with conviction, so the EA buys the breakout.
- Short entry signal. The mirror image: a bearish engulfing candle that closes cleanly below S1, having come down from at or above it. This is read as support breaking, so the EA sells the breakdown.
- The clean-break filter. A break only counts if price closes beyond the pivot by
BreakFracof the pivot range. This margin is intended to filter out marginal pokes that barely tag the level.
- The scalp take-profit. The base trade's take-profit is placed a quick
TargetFracof the range away from entry — the strategy aims to capture the initial thrust rather than hold for a long trend.
- The base stop-loss. The base stop is placed a structural pad (
StopFracof the range) beyond the hedge trigger, so the hedge mechanic always has a chance to fire before the base stop is hit.
- The hedge (false-break reversal). While the base trade is open, if price travels
FailFracof a range back through the broken level, the break is treated as failing. The EA then opens an opposite market leg — a genuine locked hedge — sized atHedgeVolFactortimes the base lots. The idea is that the very fakeout that would have stopped out the base trade may instead become a reversal trade riding the snap-back toward the central pivot.
- Basket money management (the dominant exit). Once a hedge is live, two account-currency thresholds govern the exit. If net floating profit reaches
BasketTpMoney, the EA closes everything. If net floating loss reachesBasketSlMoney, it flattens the whole basket — a hard ceiling for the failure mode where price trends strongly one way after the hedge locks.
- Spread guard. No new entry is taken while the current spread (in points) exceeds
MaxSpreadPoints, helping the EA avoid entering during illiquid, wide-spread conditions.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| PivotLookback | 20 | 5 | 150 | Number of closed bars before the signal candle whose high/low/close define the floor pivots. |
| EngulfFactor | 1.10 | 1.00 | 3.00 | Engulfing strength: the current candle body must be at least this multiple of the prior body. |
| BreakFrac | 0.05 | 0.00 | 0.50 | Clean-break margin: the close must clear the pivot by this fraction of the pivot range. |
| TargetFrac | 0.50 | 0.15 | 3.00 | Scalp take-profit distance from entry, as a fraction of the pivot range. |
| FailFrac | 0.15 | 0.03 | 1.00 | Distance back through the broken level that confirms a false break and triggers the hedge. |
| StopFrac | 0.35 | 0.05 | 2.00 | Extra base stop-loss pad placed beyond the hedge trigger, as a fraction of the range. |
| HedgeTpFrac | 0.60 | 0.15 | 3.00 | Hedge leg take-profit (snap-back target) as a fraction of the range. |
| HedgeVolFactor | 1.50 | 0.50 | 3.00 | Hedge lot size as a multiple of the base lots (above 1 over-covers the losing leg). |
| BasketTpMoney | 20.0 | 5.0 | 2000.0 | Close the whole basket once net floating profit reaches this amount (account currency). |
| BasketSlMoney | 250.0 | 50.0 | 100000.0 | Flatten the whole basket once net floating loss reaches this amount (account currency). |
| MaxSpreadPoints | 40 | 0 | 500 | Skip new entries while spread (points) exceeds this value (0 disables the check). |
| Lots | 0.10 | 0.01 | 1.00 | Base lot size for each new breakout trade. |
| Magic | 6310 | 0 | 9,999,999 | Unique EA identifier used to track and manage its own positions. |

Recommended Chart Settings
The Engulfing Pivot Scalp Hedge was designed for liquid, breakout-prone instruments — major FX pairs such as GBP/USD or EUR/USD, or gold (XAU/USD) — on intraday timeframes of M5, M15, or M30. These are markets where floor pivots are widely watched and where genuine breaks and false breaks tend to alternate throughout the session, which is exactly the behaviour the strategy's logic is built around.
Because every buffer is scaled to the pivot range rather than to fixed pips, the EA will run on whatever symbol and timeframe you attach it to. That flexibility does not mean every market suits it equally. Results will vary significantly across different instruments, sessions, and volatility regimes, and you should study its behaviour carefully on each before drawing any conclusions.
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
This strategy has some genuine conceptual strengths. By demanding both a clean pivot break and an engulfing candle, it applies two independent filters before committing — an approach that historically aims to weed out weak, low-conviction pokes through a level. Its pivot-range scaling means it adapts its distances to volatility automatically, and its hedge mechanic is an explicit, rules-based plan for the most common breakout failure: the false break that traps the breakout crowd and snaps back.
There are equally important limitations to understand. Breakout systems are vulnerable to choppy, range-bound markets, where price repeatedly pokes through pivots without following through — producing a string of small losses. The engulfing filter reduces this but does not eliminate it. The hedge and basket logic is the highest-risk element: when a hedge locks in opposing positions, a strong one-way trend can grind the basket toward the BasketSlMoney ceiling, and an oversized HedgeVolFactor amplifies exposure rather than neutralising it. Hedging also requires a broker account that permits holding opposing positions on the same symbol, which not all brokers or jurisdictions allow.
It is also worth noting that the basket take-profit and stop-loss are defined in fixed account-currency amounts, not as a percentage of equity — so the same defaults behave very differently on a small account versus a large one. Treat every default value as a starting point for study, not a recommendation, and test thoroughly on historical data and a demo account before considering anything further.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Whatever strategy you study, keep these general principles in mind:
- Size positions conservatively. A common educational guideline is to risk no more than 1–2% of your account on any single idea. With a hedging EA, remember that your true exposure is the combined basket, not just the base leg.
- Always start on a demo account. Run the EA in simulation long enough to understand how often it hedges, how large its baskets become, and how it behaves in trending versus ranging conditions.
- Understand drawdown. Even a strategy with a sound thesis will experience losing streaks. Know the largest peak-to-trough decline you are willing to tolerate before you commit any capital.
- Match settings to your account. Because
BasketTpMoneyandBasketSlMoneyare fixed cash amounts, recalibrate them to your account size and risk tolerance rather than using the defaults blindly. - Never rely on a single backtest. Test across multiple symbols, date ranges, and spread assumptions, and remember that historical behaviour may not repeat.
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: EngulfingPivotScalpHedge.ex5 (5 downloads)
- Source Code: EngulfingPivotScalpHedge.mq5 (3 downloads)
- Documentation: EngulfingPivotScalpHedge.pdf (4 downloads)