Gold Pullback Price Action
- Experts
- Versione: 1.15
- Attivazioni: 8
Price Action v1.15 - XAUUSD H4
Price Action is an Expert Advisor for XAUUSD (gold) on the H4 chart. It waits for the market to trend, waits for a pullback, and only enters when a classic price-action candle shows that buyers are back in control.
The idea is simple: small and defined losses when the setup fails, and room for profit to run when the trend continues. There is no martingale, no grid and no averaging. Every trade has a stop loss from the moment the order is placed.
Launch discount.
The first 5 people will pay only USD 50.00.
After that, the price will return to USD 150.00.
HOW IT TRADES
1. Trend. The EA reads the swing highs and lows of the H4 chart. An uptrend requires higher highs and higher lows.
2. Higher timeframe filter. The last daily close must be above the daily EMA 50. Buys are not taken against the daily trend.
3. Pullback. Price must retrace between 38.2% and 78.6% of the last impulse leg. The EA does not chase price at the top of a move.
4. Trigger. One of these candles must close inside the pullback:
- Engulfing: the candle body is larger than the full range of the previous candle.
- Hammer: long lower shadow, small body and a small upper shadow.
- Inside bar: a small bullish candle inside a large bearish candle.
5. Entry. A buy stop order is placed above the high of the signal candle, so the trade only opens if price confirms the direction. If the breakout does not happen within 2 candles, the order is cancelled.
6. Stop loss. Below the low of the signal candle. Minimum and maximum stop distances are based on ATR, so a signal with an abnormally wide stop is skipped.
TRADE MANAGEMENT
- Breakeven: when the trade reaches 1.5 times the initial risk (1.5R), the stop moves to the entry price plus a small offset.
- Take profit expansion: the first target is 2R. Each time price covers 80% of the way to the next level, the target moves 1R further (TP1, TP2, TP3 and so on), up to a maximum of 20R.
- Profit lock: at every expansion the stop is raised to lock 50% of the open profit. The stop never moves backwards.
- Optional trailing stop (last candles, last swing low or ATR distance) and optional partial close. Both are off by default.
RISK CONTROL
- Risk per trade as a percentage of the balance or as a fixed lot. With percentage risk, the lot is calculated from the stop distance and always rounded down.
- Maximum lot, daily loss limit and maximum drawdown limit. Both limits are measured on the closed balance and pause new entries only. Open trades keep being managed.
- Spread filter, trading hours, Friday cut-off for pending orders and optional end-of-day close.
- Free margin, trading permission, symbol volume limit and freeze level are checked before every order or modification.
- On netting accounts the EA keeps a single position per symbol.
PANEL
The EA shows a floating panel that can be moved and minimized. The panel language can be English or Portuguese.
- Trend: D1 and H4 direction.
- Entry: what the EA is waiting for right now, for example "in zone, looking for trigger", "waiting for pullback" or "blocked by D1 filter", plus the time until the current candle closes and any pending order.
- Position: side, current take profit level, current result in R and in money, locked R, next target and the price that triggers the next expansion.
- Account: balance, equity, result of the day and risk per trade.
- Buttons: switch the robot, buys and sells on or off (new entries only), and close a position or all positions with a two-click confirmation.
- Details: daily EMA 50, ATR, last signal and what happened to it, last skipped signal with the reason, trade history, weekly and monthly result, current loss streak, current drawdown and a summary of the active settings.
Each closed trade is labeled on the chart as STOP (red), BE (yellow) or TPn (green), with the result in money and in R.
The EA can also write CSV logs (trades and skipped signals) to the common Files folder for your own analysis.
RECOMMENDED USE
- Symbol: XAUUSD. Timeframe: H4.
- The default settings are the recommended settings. They take buy trades only, because in our tests short trades on gold had a negative result.
- Start with 0.5% to 1% risk per trade.
- Minimum recommended deposit: 3,000 USD using a fixed lot of 0.01, or 5,000 USD using 1% risk per trade. At current gold prices the stop distance on H4 is usually 20 to 70 USD per 0.01 lot. With smaller accounts the minimum lot of 0.01 can mean more than 2% risk per trade, and in percent mode many signals are skipped because the calculated lot is below 0.01. Check the contract size of XAUUSD at your broker, because it changes the value of each lot.
- Use a hedging account if possible. Netting accounts are supported with one position at a time.
- A VPS is recommended so the EA can manage open trades without interruption.
BACKTEST INFORMATION
MetaTrader 5 Strategy Tester, XAUUSD H4, every tick based on real ticks, 23 Feb 2020 to 29 Sep 2026, 10,000 USD deposit, 1% risk per trade, default settings:
- 99 trades, 47% winning trades
- Profit factor 2.8
- Maximum equity drawdown 6%
- Maximum of 5 consecutive losing trades
Most of the profit came from a small number of long trends. Some years were flat or slightly negative. These are backtest results, not live trading results.
PARAMETERS
Language
- Language: panel language, English or Portuguese.
Risk (start here)
- Risk mode: percent of balance or fixed lot. Default: percent.
- Risk % base: balance or equity. Default: balance.
- Fixed lot: lot used in fixed lot mode. Default: 0.01.
- Risk per trade %: default 1.0.
- Max lot: upper limit for any order. Default: 10.
- Max daily loss %: new entries stop for the rest of the day after this loss. 0 = off. Default: 3.
- Max drawdown %: new entries stop after this drawdown from the balance peak. 0 = off. Default: 15.
- Guards use equity: false = limits use closed balance (recommended).
General
- Magic number: identifies the trades of this EA.
- Analysis timeframe: current chart by default.
- ATR period: default 14.
Context
- Trade trend pullbacks / Trade ranges: enable each market context.
- Bars each side for pivot: swing detection. Default: 3.
- Bars analysed: default 150.
- Min / Max retracement %: pullback zone. Defaults: 38.2 and 78.6.
- EMA filter on trend: optional extra filter on the analysis timeframe. Default: off.
Range
- Highs/lows to form range, level tolerance, minimum range width, range target and minimum R to the opposite side.
Triggers
- Engulfing, Hammer, Inside bar, Ignored bar: switch each trigger on or off.
- Hammer wick and opposite wick ratios, engulfing rule, inside bar mother size and stop placement.
- Strength filter: off by default.
- Elephant bar: available, off by default.
Execution
- Entry buffer / Stop buffer (points): default 2.
- Pending order life (bars): default 2.
- Min stop / Max stop (x ATR): defaults 0.3 and 2.5.
- Max open buys: default 2.
- Max open sells: default 0 (buys only on gold).
- Protected trades free a slot: a trade with the stop at breakeven or better does not count toward the limit. Default: on.
- Max total per side: default 5.
- Higher TF trend filter, higher timeframe and its EMA: default D1 and EMA 50.
- Max trades per day, max spread, start hour, end hour (server time).
- Friday cut-off, Friday close positions, close all at end of day.
Trade management
- Use breakeven / Breakeven at (R): default 1.5.
- Breakeven offset (points): default 5.
- Trailing mode: off, last N candles, last swing or ATR distance. Default: off.
- TP1 (R): default 2.
- Step between TPs (R): default 1.
- Expand at X% of current TP: default 80.
- Lock X% of profit on expand: default 50.
- Max TP in R: target ceiling. 0 = unlimited. Default: 20.
- Expansion trigger base and lock base: advanced options.
- Partial close % and partial at (R): default off.
Visual
- Draw pivots, range and signals.
- Next TPs shown / hit TPs shown.
- Panel starts minimized.
- Show close buttons on the panel.
- Apply chart theme (black background, green and red candles), wick color, restore colors on removal.
- Mark closed trades on the chart and the band considered as breakeven.
Logs and performance
- Write CSV logs.
- Minimum price step to recalculate trade management (x ATR). Default: 0.02.
SUPPORT
Questions and suggestions are welcome in the comments section or through private messages on MQL5.com.
RISK DISCLAIMER
Past performance does not guarantee future results. Trading involves risk of capital loss. This version is intended for testing on demo accounts.
