The Gold Pullback MT5
- Эксперты
-
Peng Peng Gao
Apex Quant Labs | Algorithmic Trading Systems for MetaTrader 4 & 5 - Версия: 1.0
- Активации: 10
The Gold Pullback is an Expert Advisor for gold (XAUUSD) on the M15 timeframe. It waits for a strong trend, then enters when price makes a sharp short-term move against that trend: it buys deep dips in uptrends and sells sharp rallies in downtrends. The position is closed when price recovers from the pullback or when the profit target is reached.
Every trade is opened with a stop loss. The EA holds one position at a time and uses no martingale, no grid and no averaging.
How it works
- Trend filter: the last closed bar must be far enough from the low (buy) or the high (sell) of a long trend box (70 bars by default).
- Pullback entry: price must break sharply out of a short pullback box (4 bars) against the trend and close in the outer zone of that box.
- Exit: the position is closed when price breaks back out of the pullback box in the trade direction, or when the floating profit reaches the profit target. Exits are checked at the open of each new bar, or on every tick if selected.
- Stop loss: at the extreme of a 70-bar stop-loss box, kept between a minimum and a maximum distance. A distant take profit is also set on every order.
- Filters: maximum spread, trading hours, and no entry when a bar opens with a gap against the trade.
Money management
- Fixed lot, or compounding by equity: by default 0.01 lot for every 300 USD of equity, rounded down to the broker's lot step.
- Before each entry the free margin is checked. If it is not sufficient, the lot is reduced or the trade is skipped.
Built for live trading
- Works with any gold quote: 2-digit and 3-digit gold prices are detected automatically, so 1 pip is always 0.10 USD and the distances stay the same on every broker.
- Session-aware orders: orders are sent only inside the symbol's trading session. At the daily session open, and after temporary rejections (requote, price changed, timeout, no connection), the order is retried within the same bar.
- Broker limits respected: stop loss and take profit keep the broker's minimum stop distance; lot sizes keep the symbol's minimum, maximum and step.
- No stale signals: after a terminal restart or a change of inputs, the EA waits for a new bar before it opens a trade.
- Permission checks: orders are sent only when automated trading is allowed and the symbol can be traded.
- Input checks: invalid input combinations are rejected at start, with a clear message in the Experts log.
Dashboard
The on-chart dashboard (live charts and visual backtests) shows:
- Status: waiting for signal, in position, paused, market closed, outside trading hours, spread too high, auto trading off.
- Account: balance, equity, and the EA's profit today and in total.
- Position: direction and lots, entry price, floating profit, stop loss and take profit.
- Strategy: trend state, spread against the limit, next lot size, trading hours.
Buttons:
- Pause Entries / Resume Entries: stops new trades while open positions are still managed. The state is kept after a terminal restart.
- Close Position: closes the EA's positions after a confirmation.
- The panel can be collapsed and is scaled for high-DPI screens.
Recommendations
- Symbol: XAUUSD (gold). Timeframe: M15.
- Account: hedging account recommended. Low-spread gold pricing (ECN / raw spread) is preferred.
- One chart: attach the EA to one XAUUSD M15 chart per magic number, and keep the terminal running (a VPS is recommended).
- Test first: run it on a demo account, and backtest on your broker's data with "Every tick based on real ticks".
Input parameters
General Settings
- Magic Number (5168): identifies the EA's trades.
- Order Comment: comment on the EA's orders.
- Max Spread (20 pips): no new trade above this spread.
Money Management
- Lot Sizing Mode: Fixed lot / Compounding by equity.
- Fixed Lot Size (0.01).
- Compounding: Equity per Step (300 USD) and Lots per Step (0.01): lot = equity ÷ Equity per Step × Lots per Step.
Trend Filter
- Trend Box Period (70 bars).
- Min Distance from Box Extreme (290 pips): minimum distance of the last close from the trend box low (buy) or high (sell).
Pullback Entry
- Pullback Box Period (4 bars).
- Min Pullback Depth (59 pips): minimum move of the last close against the trend, measured from the previous pullback box.
- Entry Zone (5%): the close must be in this bottom (buy) or top (sell) part of the pullback box.
Exit Rules
- Exit Check Timing: at next bar open / on every tick.
- Breakout Exit Level (100%): the close must be in this top (buy) or bottom (sell) part of the pullback box for the breakout exit; 100% means any breakout.
- Profit Target (20 pips): floating profit per lot that closes the position.
Stop Loss
- Stop-Loss Box Period (70 bars).
- Min Stop Loss (215 pips) and Max Stop Loss (1100 pips).
Trading Hours (Server Time)
- Start and end hour and minute (default: all day).
Dashboard
- Show Dashboard, X and Y offset.
Advanced
- Points per Pip (0 = auto): on gold, auto means 1 pip = 0.10 USD (10 points on 2-digit quotes, 100 points on 3-digit quotes); on other symbols, 10 points. Any other value overrides the detection.
- Auto-Scale Distances on Non-Gold Symbols (true).
Risk
With the default settings one stop loss is 215 to 1,100 pips: 21.50 to 110 USD per 0.01 lot on a standard 100-ounce contract, or about 7% to 37% of equity at 0.01 lot per 300 USD. Use a larger Equity per Step for lower risk. Trading gold with leverage carries a high level of risk. Past results, including backtests, do not guarantee future results. Trade only with money you can afford to lose.
