MetaEAs Gold Candle Momentum
- Experts
- Versione: 3.0
- Aggiornato: 5 dicembre 2026
- Attivazioni: 10
MetaEAs Gold Candle Momentum is an Expert Advisor for MetaTrader 5. It is written for XAUUSD (gold). Version 3.00 looks for a strong H1 candle in the direction of the H4 trend. It trades rarely: on gold, a few trades per month is typical with the default inputs.
How it works
The Advisor inspects each H1 candle after that candle has closed. It treats the candle as "strong" when all of the following are true:
- The body is at least BodyATR times ATR(H1, 14) (default 1.0).
- The body is at least BodyRangeRatio of that candle's high-low range (default 0.5).
- The candle opened inside the session window in server time (default: from 09:00, and before 21:00). Set SessionStartHour and SessionEndHour to the same value to turn the session filter off. The session filter is not applied to daily or higher signal candles.
A buy is allowed only when that closed candle is bullish (close above open) and the last closed H4 candle closed above EMA 50. A sell is allowed only when that closed candle is bearish (close below open) and the last closed H4 candle closed below EMA 50.
If those conditions are met, the Advisor may send a market order in the first EntryWindowMinutes of the next H1 candle (default 5 minutes). It does not enter on the candle that was already open when the Advisor was attached to the chart, and it does not chase a signal after the entry window has passed.
The signal and trend timeframes, the EMA period and the ATR period are inputs (defaults: H1, H4, EMA 50, ATR 14).
Stops, target and trailing stop
Every trade is sent with a stop loss and a take profit.
- The stop distance is the greater of: ATR(H1, 14) multiplied by ATRStopMultiplier (default 1.5), MinStopDistance (default 1.0 price unit), and the current spread plus the broker's minimum stop gap.
- The take profit is RewardRisk times the stop distance (default 6.0). This is a far target. Trade management is mainly done by the trailing stop.
- When price has moved by TrailStartR times the initial stop distance (default 1.0), the stop trails TrailATR times ATR(H1, 14) (default 2.5) behind the last closed M1 close. The trailing stop is updated once per minute and is only ever tightened. Set TrailATR to 0 to turn trailing off.
- A break-even move is available (BreakEvenR and BreakEvenLockDistance) but is off by default (BreakEvenR = 0).
Price distances are set in price units, not in points. On a standard XAUUSD quote, 1.0 equals a 1.00 move in the gold price. The same input values keep the same meaning on 2-digit and 3-digit gold symbols. On non-gold symbols, those gold-unit distances can be scaled automatically (see below).
Position rules
The Advisor holds at most one position at a time. It does not use martingale, grid or averaging. It will not open a new trade while a position is already open on the same symbol, including a manual trade or a trade placed by another Expert Advisor.
Risk and daily limits
When AutoLot is enabled (the default), lot size is calculated so that a move from the entry to the stop risks RiskPercent of current equity (default 0.5%). You may set a manual lot instead. That lot is still capped by the same risk budget, and also by the unused portion of the daily loss limit, by MaxLot (default 5.0), by the symbol's volume limit, and by 90% of free margin.
Lot size is computed from the broker's contract settings (OrderCalcProfit, with a tick-value fallback). This allows the same percentage risk to be applied on USD accounts, cent accounts and other account currencies.
If the risk-based lot is smaller than the broker's minimum lot, and AllowMinLotFallback is enabled (the default), the Advisor may use the minimum lot, but only when the risk of that lot is no more than MinLotRiskMultiple times RiskPercent (default 3.0) and still fits inside the remaining daily loss limit. Otherwise the trade is skipped. On a small standard account this can mean the actual risk is higher than RiskPercent. For gold, an account of roughly 2,000 or more in account currency, or a cent account, is a better starting size if you want the 0.5% risk figure to be achievable. You can turn the fallback off by setting AllowMinLotFallback to false.
Daily loss and daily profit locks are percentages of the account balance recorded at the start of the trading server's day (defaults: 3% loss and 6% profit). The profit lock can be turned off by setting DailyProfitPercent to 0. When a lock is reached, the Advisor closes its own positions and does not open new trades until the next server day. The day-start balance and the lock are stored so that restarting the Advisor during the day does not reset them.
If today's deal history cannot be read, the Advisor does not open new trades. Open positions are still managed.
Spread and execution
The allowed spread at entry is the greater of MaxSpreadDistance (default 0.50 price units) and MaxSpreadStopPercent of the stop distance (default 10%; set to 0 to use only MaxSpreadDistance). If the spread is wider when a signal first becomes valid, the signal is kept and the Advisor retries if the spread tightens, but only while the entry window is still open.
The Advisor also checks volume minimum, maximum and step, free margin, stop and freeze levels, and the symbol's allowed filling mode. If a filling mode is rejected, it can retry with another allowed mode. A rejected or blocked entry, other than a wide spread or an existing position on the symbol, consumes the signal for that candle.
A unique magic number (default 26120601) marks this Advisor's trades so they are not mixed with trades from other Expert Advisors, provided those programs use a different magic number.
Symbol auto-scaling
On gold symbols (names containing XAU or GOLD, or a base currency of XAU), distance inputs are used as entered. On other symbols, when AutoScaleDistances is enabled (the default), MinStopDistance, MaxSpreadDistance, BreakEvenLockDistance and MaxDeviationPrice are multiplied by price / ScaleReferencePrice (default 2,000). This is so the same input set stays usable if the Advisor is attached to a non-gold symbol, for example during a broker or Market validation test. The product is still written for XAUUSD.
Recommended use
- Symbol: XAUUSD.
- Chart: H1 is a convenient chart to attach to, because that is the default signal timeframe. The Advisor reads H1 candles, the H4 trend and M1 data for the trailing stop itself, so the chart period does not have to match. Attaching it to the H1 chart makes the on-chart status easier to follow.
- First use: a demo account. Let it run for a period you consider sufficient before any use on a live account. Because the Advisor trades rarely, a useful demo period is measured in months rather than days.
- Account size: a standard gold account of roughly 2,000 or more in account currency, or a cent account, is recommended so that risk-percent sizing can stay near RiskPercent. Smaller standard accounts may be forced to the broker's minimum lot.
- Broker: a low-spread ECN or similar gold feed. Results can differ between brokers because of spread, slippage and execution. Session hours are in the broker's server time, so check that the 09:00–21:00 window matches the session you want on that server.
- Connection: a VPS or another stable, always-on connection is recommended, because entries are evaluated when an H1 candle closes and only in a short window after that, and the trailing stop updates on each new M1 candle.
- Inputs: the default values are a reasonable starting point. Set RiskPercent, AllowMinLotFallback and the daily limits to match the size of the account. Change Magic if another program already uses the default number.
This listing does not include backtest results or live results. Test it in the MetaTrader 5 Strategy Tester, and on a demo account with your own broker's data, before using it on a live account.
Risk disclosure
This Expert Advisor is a trading tool only. It is not financial, investment or trading advice. Gold, forex and CFDs are leveraged products. You can lose money, including more than your deposit, depending on the account type and the broker. Nothing in this listing promises, guarantees or implies a profit, a win rate, or a limit on losses. A stop loss, the trailing stop and the daily locks reduce risk; they do not remove it. The minimum-lot fallback, when it is used, can raise the risk of a trade above RiskPercent. Slippage, price gaps, widening spreads, news spikes, weekend gaps and connection problems can cause a fill, a stop or a close to differ from the planned price. You are solely responsible for any trades placed on your account.
