Trading strategy Logic and function tested

GDI Trend Pullback EA

Gold only. Buys dips in an uptrend and sells rallies in a downtrend. Three operating modes: Alert only (default), Automatic trading - standard, and Automatic trading - light grid.

  • Version8.13
  • Last updated2026-12-05
  • SymbolGold (XAUUSD) only
  • TimeframeAny; M15 or H1 is the usual choice

Download GDI_Trend_Pullback_EA.ex5 ↓ Settings file (.set) ↓ Get a GDI Key (7-day free trial) →

Status. The logic and the operation of this EA have been tested. Backtests are in progress and will be published on each EA's page. Backtesting is the user's own responsibility: whoever pays for the key may use and test every product. In that check the entry filters were relaxed so that all three modes produced orders inside the test window: with the factory settings, signals from this EA are rare.

What it is

A trend-following pull-back strategy for gold. The Awesome Oscillator and ADX (with its +DI and -DI lines) decide whether there is a trend and which way it runs. An envelope around a moving average marks the dip or rally worth trading. An extreme CCI reading can close a single order early.

The three operating modes

ModeWhat the EA does
Alert only (default)Never sends an order. Each entry signal raises an alert with price, suggested stop and target.
Auto trading standardOne order at a time and never more than one new entry in the same trading session. Stop and target are set on the server.
Auto trading light gridThe first entry follows the standard rules. Further levels are added only 800 points (8.00 USD) apart, with the same lot and direction, up to 3 levels in total, with a maximum basket loss of 2 per cent of the balance.

The selector is the first input in the window (InpMode). There is no martingale in any mode (the lot is never increased after a loss) and no hedging (the EA never opens against an open gold position or order on the account). Where the strategy text allows several trades a day or several open positions, the operating mode is the stricter rule and wins.

The strategy: how it decides

Who it suits

Traders who prefer to join a trend on a pull-back and accept that sideways markets produce false starts.

What happens behind the scenes

  1. On start the EA checks that the chart is gold (XAUUSD with any broker suffix, or GOLD); on any other symbol it does not trade.
  2. It verifies the GDI Key with sync.golddailyinsights.com when it starts and again periodically. Without a valid key it sends no order and no signal alert.
  3. The signal is evaluated once per new bar by default. Before any new order it checks, in turn: trading permission, one entry per session, protection and risk limits, trading days and hours, direction, news, spread and the trend filter.
  4. Open positions are managed on every pass: stop, target, break-even, trailing, strategy exit and basket rules.
  5. State is rebuilt from the open positions and the deal history after a restart. Messages explaining every skipped signal appear in the Experts tab and on the panel.

Trading sessions and the one-entry rule

Sessions follow your broker's server time. The defaults suit brokers on GMT+2 or GMT+3 and can be changed with InpSessLondonHour and InpSessNewYorkHour.

SessionServer time (default)
Asia00:00 to 10:00
London10:00 to 15:00
New York15:00 to 24:00

In both automatic modes there is at most one new entry per session, even if the first trade has already closed. The EA checks its memory and the account's deal history, so restarting the terminal does not reset the count. If the history cannot be read, it does not open.

The light grid in detail

A light grid increases the amount at risk while price moves against you. Use it only if you accept the full basket loss.

Requirements

RequirementDetail
PlatformMetaTrader 5 (.ex5 file; MetaTrader 4 is not supported).
SymbolXAUUSD with any broker suffix, or GOLD.
TimeframeAny; M15 or H1 is the usual choice
Account typeHedging account for the light grid.
GDI KeyRequired. The file itself is free to download.
Terminal settingsTools > Options > Expert Advisors: tick 'Allow WebRequest for listed URL' and add https://sync.golddailyinsights.com. For the automatic modes, allow Algo Trading.
ComputerThe terminal must stay open and connected while the EA works; a VPS is the usual choice.

Download and licence

You receive the compiled file only: GDI_Trend_Pullback_EA.ex5, with a settings file holding every input at its default and an empty key. The EA works only with a valid GDI Key typed into InpGdiKey.

Compiled with MetaEditor: 0 errors, 0 warnings. SHA-256 of the .ex5 file: 866531d838e6c71d4a1ac556fbc5bc38ece9bb1b3c607882198c877cf1fad9b1.

How the key works: GDI Key and licence check.

Installation and first run

  1. Copy the .ex5 file into MQL5/Experts in your MetaTrader 5 data folder (File > Open Data Folder) and refresh the Navigator.
  2. In Tools > Options > Expert Advisors, tick 'Allow WebRequest for listed URL' and add https://sync.golddailyinsights.com.
  3. Open an XAUUSD chart and drag the EA onto it. On the Inputs tab press Load and choose the .set file.
  4. Paste your GDI Key into InpGdiKey. Leave InpMode on Alert only for the first sessions.
  5. Check the Experts tab: the licence is confirmed and the operating mode is shown.
  6. When you choose an automatic mode, start with the smallest lot, preferably on a demo account, and tick the Common tab option 'Allow Algo Trading'. A real account also needs InpAllowReal set to true.

Running your own backtest

Open the Strategy Tester (Ctrl+R), choose the EA, an XAUUSD symbol and a period, load the settings file and select the operating mode you want to study. The key is not checked in the tester. The economic calendar and push notifications do not work inside the tester, so news filters behave differently there. Backtests are in progress and will be published on each EA's page. Backtesting is the user's own responsibility: whoever pays for the key may use and test every product.

Inputs: the complete manual (110 inputs)

Listed in the order of the MetaTrader inputs window. Distances marked 'points' are broker points unless the text says otherwise.

Operating mode and general

InputDefaultWhat it does and how to use it
InpMode1) Alert only (default): no orders at allOperating mode. Choose this first. Alert only is the safe start. Options: 1) Alert only (default): no orders at all; 2) Automatic trading - standard: one order at a time; 3) Automatic trading - light grid: max 3 levels, fixed lot, basket max loss.
InpGdiKeyempty: paste your keyGDI Key. Paste your personal key here; the EA sends no order and no alert without a valid key.
InpMagic26120001Magic number (0 is not accepted). Keep it unique for each copy of an EA on the same account; do not change it while the EA has open positions.
InpAllowRealfalseI confirm this is a real account I want to trade. Leave false until you really intend to trade a real account.
InpCommentGDI_Trend_Pullback_EAOrder comment.
InpSymbolSuffixemptySymbol suffix (not used: gold only, the chart symbol is always the one traded).

Alerts (types used in every mode)

InputDefaultWhat it does and how to use it
InpAlertPopuptruePop-up alert on screen. Affects messages only.
InpAlertPushfalsePush notification to phone. Affects messages only.
InpAlertEmailfalseE-mail. Affects messages only.
InpAlertSoundfalseSound. Affects messages only.
InpAlertFilealert.wavSound file. Affects messages only.
InpAlertSignalstrueAlert on entry signals. Affects messages only.
InpAlertOrderstrueAlert on orders opened and closed. Affects messages only.
InpAlertLimitstrueAlert on protection and risk limits. Affects messages only.
InpAlertGapMin5Minutes between repeated alerts per symbol. Affects messages only.

Execution

InputDefaultWhat it does and how to use it
InpDirectionBuy and sell (never both on one symbol)Allowed direction. Options: Buy and sell (never both on one symbol); Buy only; Sell only.
InpEvaluateOnce per new barEvaluate the entry signal. Options: Once per new bar; On every check (about once a second).
InpOppositeIgnore itOn an opposite signal. Options: Ignore it; Close what is open; Close, then open the other way.
InpMaxTradesDay0Max new trades per day (0 = no limit).
InpCooldownBars1Cooldown after closing, in bars (0 = none). Counted in bars. Shorter reacts faster and gives more false signals; longer is slower and steadier.

Entry signal

InputDefaultWhat it does and how to use it
InpSignalTfcurrent chartSignal timeframe (current = chart). Any MetaTrader timeframe; 'current' follows the chart.
InpAdxMin22.0The trend must be at least this strong (ADX).
InpEnvPeriod20Envelope: average period. Counted in bars. Shorter reacts faster and gives more false signals; longer is slower and steadier.
InpEnvWidth0.20Envelope: width on each side (% of price).
InpCciPeriod14CCI period (used to close early). Counted in bars. Shorter reacts faster and gives more false signals; longer is slower and steadier.
InpCciExit150.0Close early at CCI plus or minus (0 = never).

Money management

InputDefaultWhat it does and how to use it
InpLotModeFixed lotLot mode. Options: Fixed lot; Risk per cent of balance; Fixed lot per balance step.
InpFixedLot0.01Fixed lot (0 = smallest of the symbol). Start with 0.01. On a standard gold contract, 0.01 lots gain or lose about 1 USD for each 1.00 USD move.
InpRiskPercent0.5Risk per trade, % of balance (single order). A smaller number means a smaller position for the same stop distance.
InpBalanceStep1000.0Balance step for one fixed lot.
InpMaxLot1.0Maximum lot per order (0 = broker limit). Start with 0.01. On a standard gold contract, 0.01 lots gain or lose about 1 USD for each 1.00 USD move.

Stops, targets and exits (single order)

InputDefaultWhat it does and how to use it
InpStopUnitATR multiplesStop and target unit. Options: ATR multiples; Points.
InpAtrPeriod14ATR period (signal timeframe). Counted in bars. Shorter reacts faster and gives more false signals; longer is slower and steadier.
InpStopLoss2.0Stop loss (0 = no stop).
InpTakeProfit3.0Take profit (0 = no target).
InpUseBreakEvenfalseUse break-even. Moves the stop to the entry area once the trade is in profit. Ignored while the light grid is active.
InpBeTrigger1.0Break-even trigger. Moves the stop to the entry area once the trade is in profit. Ignored while the light grid is active.
InpBeOffset0.1Break-even offset beyond entry. Moves the stop to the entry area once the trade is in profit. Ignored while the light grid is active.
InpUseTrailingfalseUse the trailing stop. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpTrailStart1.5Trailing start. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpTrailDistance1.0Trailing distance. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpTrailStep0.1Trailing step (0 = every improvement). Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpPartialAt0.0Partial close at (0 = none; hedging account). Needs a position large enough to be split at your broker's lot step. Ignored while the light grid is active.
InpPartialPct50.0Partial close, % of the volume. Needs a position large enough to be split at your broker's lot step. Ignored while the light grid is active.
InpUseOwnExittrueUse the strategy's own exit signal. true switches it on, false switches it off.
InpMaxBarsOpen0Close after this many bars (0 = no limit).

Light grid

InputDefaultWhat it does and how to use it
InpGridAtrTfH4ATR timeframe for spacing. Any MetaTrader timeframe; 'current' follows the chart.
InpGridSpacing800.0Fixed distance between levels (points, 100 = 1.00 USD).
InpGridMaxLevels3Max levels incl. the first (1 to 3). Moving the level further from the middle gives fewer signals.
InpGridNewBarOnlytrueNew level only on a new signal bar. true switches it on, false switches it off.
InpGridMinMinutes60Minimum minutes between levels.

Light grid: basket exit and safety

InputDefaultWhat it does and how to use it
InpBasketUnitATR multiples from the average priceBasket target and trailing unit. Options: ATR multiples from the average price; Money (account currency); Percent of balance; Points from the average price.
InpBasketTarget1.0Basket profit target.
InpBasketTrailStart0.0Basket trailing start (0 = off). Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpBasketTrailDist0.0Basket trailing distance (0 = off). Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpBasketMaxLossPct2.0Max basket loss, % balance (mandatory). A protective limit; check it against your balance.
InpGridSafetyMult1.25Server stop at max basket loss distance x this (1 to 2; 0 = off).
InpBasketMaxLots0.10Max total lots per basket (mandatory). Start with 0.01. On a standard gold contract, 0.01 lots gain or lose about 1 USD for each 1.00 USD move.
InpBasketMaxHours0Max basket age, hours (0 = no limit). Hours follow the broker's server time.
InpStopCooldownHrs24Cooldown after a basket or float stop, hours.
InpCloseBeforeWkendfalseClose baskets before the weekend. true switches it on, false switches it off.
InpFinishOnlyfalseNo new baskets, only finish the open ones. true switches it on, false switches it off.

Equity protection (trailing lock)

InputDefaultWhat it does and how to use it
InpEqLevelsPercent of start-of-day balanceLevels are set as. Moving the level further from the middle gives fewer signals. Options: Money (account currency); Percent of start-of-day balance; Points x open volume (per symbol only).
InpEqUseTrailingfalseUse the equity trailing lock. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpEqTrailStart1.0Trailing lock starts at floating profit. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpEqTrailLock0.5Profit secured once started. Trailing locks in part of a move but can close a trade early. Ignored while the light grid is active.
InpEqUseTargetfalseUse an equity profit target. true switches it on, false switches it off.
InpEqTarget2.0Close when floating profit reaches.

Risk management (this robot only)

InputDefaultWhat it does and how to use it
InpRiskModePercent of start-of-day balanceLimits are set as. Options: Money (account currency); Percent of start-of-day balance.
InpUseDailyLimittrueUse daily loss limit (from today's peak). A protective limit; check it against your balance.
InpDailyLimit5.0Daily loss limit. A protective limit; check it against your balance.
InpDailyActionClose the positionsWhen the daily limit is reached. A protective limit; check it against your balance. Options: Close the positions; Alert only.
InpUseFloatLimittrueUse floating loss limit. true switches it on, false switches it off.
InpFloatLimit4.0Floating loss limit.
InpFloatActionClose the positionsWhen the floating limit is reached. Options: Close the positions; Alert only.
InpUseLossCountfalseStop after a number of losing trades. true switches it on, false switches it off.
InpMaxLossCount5Losing trades allowed per day. A protective limit; check it against your balance.
InpLossCountActionClose the positionsWhen that number is reached. Options: Close the positions; Alert only.

Trading time (broker server time)

InputDefaultWhat it does and how to use it
InpSessionFrom07:00Session start HH:MM (both empty = 24h). Hours follow the broker's server time.
InpSessionTo21:00Session end HH:MM. Hours follow the broker's server time.
InpSessLondonHour10One entry per session: London starts (server hour; Asia from 00:00). Adjust to your broker's server clock.
InpSessNewYorkHour15One entry per session: New York starts (server hour), to 24:00. Adjust to your broker's server clock.
InpTradingDays12345Trading days (1 Mon to 7 Sun; empty = all).
InpOutsideNo new orders (keep managing)Outside trading hours. Options: No new orders (keep managing); No new orders, alert signals only; Close the positions.
InpFridayLast20:00Friday: last new trade HH:MM (empty = none).

News filter (MT5 calendar)

InputDefaultWhat it does and how to use it
InpNewsFiltertruePause new trades around news. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsImportanceHIGHMinimum importance. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsBefore20Minutes before. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsAfter20Minutes after. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsCurrenciesemptyExtra currencies (symbol's own always count). Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsBlockLevelstrueAlso block new grid levels during news. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsCloseLoserfalseClose a losing basket when news arrives. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.
InpNewsCloseLoss1.0Minimum basket loss for that cut, % balance. Uses the MetaTrader economic calendar, which is not available inside the Strategy Tester.

Spread and execution

InputDefaultWhat it does and how to use it
InpSpreadRatio4.0Wait if spread above N x usual (0 = off). Raise it if your broker's gold spread is normally wider; lower it to be stricter.
InpMaxSpreadPts0Max spread in points, all symbols (0 = off). Raise it if your broker's gold spread is normally wider; lower it to be stricter.
InpSlippagePts0Max slippage in points (0 = automatic).
InpOrderTries3Order attempts.
InpRetryPauseMs300Pause between attempts, ms.
InpScalePointstrueScale point inputs to each symbol. In broker points.

Trend filter (trade with the higher trend)

InputDefaultWhat it does and how to use it
InpTrendSwitchAutomatic (on in Light grid, off otherwise)Only start trades with the trend. Options: Automatic (on in Light grid, off otherwise); On; Off.
InpTrendTfH4Trend timeframe. Any MetaTrader timeframe; 'current' follows the chart.
InpTrendPeriod200Trend average period (0 = filter off). Counted in bars. Shorter reacts faster and gives more false signals; longer is slower and steadier.
InpTrendMethodEMATrend average method.
InpTrendMaxAdx0.0Max ADX to start a grid (0 = off).
InpTrendBlockLevelstrueBlock new levels against the trend. Moving the level further from the middle gives fewer signals.

Gold (XAUUSD) settings

InputDefaultWhat it does and how to use it
InpG2Spread60Max spread on gold, points (0 = general). Raise it if your broker's gold spread is normally wider; lower it to be stricter.

Panel and testing

InputDefaultWhat it does and how to use it
InpShowPaneltrueShow the panel on the chart. Display only; it does not change any trade.
InpPanelSymbols8Symbols listed on the panel (0 = summary only). Display only; it does not change any trade.
InpDetailedLogfalseDetailed log. true switches it on, false switches it off.
InpTesterReporttrueWrite the test report file in the Strategy Tester. true switches it on, false switches it off.

Risks

Frequently asked questions

Which symbol does it trade?
Gold only: XAUUSD with any broker suffix, or GOLD. On any other symbol it does not trade.
Does it open orders as soon as I attach it?
No. The default mode is Alert only. Orders are sent only after you choose one of the two automatic modes, and on a real account only after you also tick the real-account confirmation.
Does it use martingale or hedging?
No. The lot is never increased after a loss and the EA never opens against an open gold position or order on the account.
Why did it not enter on a second signal?
In the automatic modes there is at most one entry per trading session and one order at a time.
Do I need a GDI Key?
Yes. The file is free to download and works only with a valid GDI Key. In the MetaTrader Strategy Tester the key is not checked.
Is the source code available?
No. You receive the compiled .ex5 file and a settings file.
Are there backtest results?
Backtests are in progress and will be published on each EA's page. Backtesting is the user's own responsibility: whoever pays for the key may use and test every product.
Is profit guaranteed?
No. Trading carries a high level of risk and an EA can lose money.

Trading carries risk. An EA can lose money, and nothing here is advice. Risk disclosure

Next steps

GDI Key and plans Getting started Ask a question All GDI EAs

Version 8.13, last updated 2026-12-05.