Trend Pullback Bot
Expert Advisor for MetaTrader 5 that follows the trend: it buys pullbacks to the fast EMA in an up trend (sells them in a down trend) and lets the trade run with a trailing stop.
- Net return
- +174.2%
- Profit factor
- 1.67
- Max drawdown
- 18.1%
- Trades
- 303
Backtest on XAUUSD M15 over 82 months, from $500 at 0.5% risk per trade and a 30% drawdown limit. Past results do not promise future returns.
Recommended MT5 setup
Best: XAUUSD · M30Captures EMA pullbacks in established daily trends with a 6 ATR chandelier trailing stop.
- Primary chart
- XAUUSD M30
- Secondary pair
- USDJPY H1
- Suggested risk
- 0.75%–1.0%
- 7-year winning months
- 54W / 25L
Optimized v1.4.0 defaults built into this EA
BiasTimeframeD1ATR Ratio Band0.7–1.8MaxEmaDistanceAtr2.5MaxWeeklyLossPercent1.5%TrailAtr6.0XAUUSD M30 · $10k @ 1% (M15 $500@0.5%: +174.2%). Secondary pair verified on USDJPY H1 (+49.1%, PF 1.43, DD 12.8% at $10k @ 1%).
What it does
7 capabilities- Higher-timeframe bias, and the chart's own EMAs must agree with separation and slope
- Entry on a clean pullback to the fast EMA that closes back in the trend direction
- Wide chandelier trailing stop (6 ATR) with cost-adjusted break-even at 1.5R and no premature target cap
- Trading hours filter in GMT with automatic DST offset refresh, rollover pause, Friday cutoff and MT5 Economic Calendar news blackout
- Rolling spread-spike guard freezes stop tightening during wide spreads
- Account-currency OrderCalcProfit risk sizing, margin cap, monthly loss budget and profit lock
- Pre-flight OrderCheck, freeze-level protection and execution circuit breaker
How it works
The bot takes the direction from the higher-timeframe bias and checks that the chart agrees: the close must be on the trend side of the chart's slow EMA. It then waits for a pullback: a bar that reaches the fast EMA and closes back beyond it in the trend direction. The first stop is a set number of ATRs from the entry and there is no fixed target. On every new bar the stop trails a set number of ATRs behind the best price since the entry, and it is never moved back, so a long trend is held as long as it lasts. The position is sized by the risk you choose. The key-level, confirmation and target inputs of the other FXOpsPro bots have no effect on this bot. The strategy runs in the bot's DLL and works only with an approved FXOpsPro license key.
Parameters & options
Configured directly in MetaTrader 5 Expert Advisor inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
TrendFastEma | int | 20 | Trend: fast EMA of the chart; a pullback must reach it |
TrendSlowEma | int | 50 | Trend: slow EMA of the chart; the close must be on the trend side of it |
StopAtr | number | 3.0 | First stop loss, in ATRs from the entry |
TrailAtr | number | 6.0 | Trailing stop: this many ATRs behind the best price since the entry, moved at every new bar and never back (6.0 for this bot) |
MinLotRiskPercent | number | 4.0 | When the account is too small for RiskPercent, trade the smallest lot if it loses at most this % of the balance at the stop (4.0 for this bot) |
MinStopSpreads | number | 20.0 | Skip a signal when the stop loss is closer to the entry than this many spreads (20 for this bot; 0: off) |
MaxMarginPercent | number | 18.0 | Account protection: one trade uses at most this % of the free margin; the lot size is reduced to fit (18 for this bot) |
MaxWeeklyLossPercent | number | 1.5 | Account protection: no new trades for the rest of the calendar week (Sunday 00:00 server time) after losing this % of the week's starting balance (1.5 for this bot; 0: off) |
MaxMonthlyLossPercent | number | 5.0 | The bot loses at most this % of the month's starting balance in a calendar month: new trades are sized to the loss that is left, then none until the next month (5.0 for this bot; 0: off) |
MonthProfitLockPercent | number | 0.25 | Month profit lock: after the month's closed result reaches this % of the month's starting balance, new trades are sized to keep MonthProfitKeepPercent of its best closed result (0.25 for this bot; 0: off) |
MonthProfitKeepPercent | number | 50.0 | Share of the month's best closed result that the month profit lock keeps, in % (50 for this bot; 0: break-even) |
DrawdownThrottlePercent | number | 0.0 | Multiply RiskPercent by DrawdownThrottleFactor while account equity is this % or more below its peak (0 for this bot: off) |
UseSessionFilter | bool | true | Trading hours: open trades only from SessionStartGmt to SessionEndGmt (on for this bot) |
SessionStartGmt | int | 6 | Trading hours: window start, hour in GMT (6 for this bot: London pre-open) |
SessionEndGmt | int | 17 | Trading hours: window end, hour in GMT (17 for this bot: stops before late NY fade) |
BiasTimeframe | text | D1 | Timeframe of the bias (D1 for this bot; current: automatic, one step above the chart) |
MinAtrRatio | number | 0.7 | Volatility regime filter: skip entries when current ATR is below this multiple of its 100-bar baseline ATR (0.7 for this bot: blocks dead chop; 0: off) |
MaxAtrRatio | number | 1.8 | Volatility regime filter: skip entries when current ATR exceeds this multiple of its 100-bar baseline ATR (1.8 for this bot: blocks panic spikes; 0: off) |
MaxEmaDistanceAtr | number | 2.5 | Anti-chase filter: skip a signal when price is already extended more than this many ATRs beyond the fast EMA in the trade direction (2.5 for this bot; 0: off) |
PartialClosePercent | number | 0.0 | Close this % of the position at the target (0 for this bot: uncapped trailing winners) |
BreakEvenRR | number | 1.5 | Before the trailing stop passes entry: move the stop to cost-adjusted break-even once the best price is this many times the open risk in profit (1.5 for this bot; 0: off) |
UseCandleExit | bool | false | Close on a reversal candle at a key zone while in profit (false for this bot: lets trend winners run with the chandelier trail) |
More trading bots



