Goldspeed Scalper
- Experts
- Version: 1.0
- Activations: 5
1. Product Overview
Goldspeed Scalper is an automated trading program (Expert Advisor, or EA) designed specifically for XAUUSD (spot gold). It runs on the MetaTrader 5 platform and is developed in the MQL5 language. Positioned as a scalping tool, it follows the core principle of "one position, one result" and pursues stable, repeatable, and verifiable execution logic. Its name combines "Gold" and "Speed", directly conveying its positioning: capturing short-term opportunities in a disciplined way amid the rapid fluctuations of the gold market.
The gold market is known for violent volatility, high liquidity, and strong sensitivity to macroeconomic news. The per-minute movement of XAUUSD often far exceeds that of ordinary currency pairs, which brings abundant short-term opportunities but also demands extremely strict trading discipline. Manual trading is easily disturbed by emotion, leading to rule-breaking behaviors such as chasing orders, holding losing positions, and over-leveraging. Goldspeed Scalper was created to solve exactly this problem: it turns trading rules into code, so that every trade strictly follows preset logic—without hesitation, without wishful thinking, and without violating risk control.
From the very beginning, this EA was designed with the goals of "passing verification, being easy to list, and having transparent parameters". It contains no grid, no martingale, no hidden external calls, and relies on no non-standard indicators. All signals come from built-in MT5 indicators, the source code is completely open and readable, and the compiled build uses the standard X64 Regular architecture, allowing it to pass the MQL5 Market automated verification process directly.
2. Design Background and Market Positioning
Among the many automated trading programs, gold EAs are the most popular category and also the most prone to failure. The reasons usually come down to three points: first, signals rely on unclosed bars, causing a serious mismatch between backtesting and live trading; second, risk control only considers entry margin while ignoring the actual loss when a stop-loss is triggered, making small accounts extremely prone to blow-ups; third, parameters lack cross-symbol compatibility—working under one quotation system but failing completely under another.
Goldspeed Scalper addresses each of these three pain points with engineering rigor. It insists on calculating signals from closed candles, eliminating future functions; it introduces a hard risk cap that works backwards from stop-loss distance to calculate potential loss, mechanically preventing single-trade blow-ups; and it replaces fixed point thresholds with relative spread judgment, allowing the same parameter set to adapt to gold quotes from different brokers. These designs make the product not only "able to run", but "able to run stably and safely", especially suitable for users with modest capital who still want automated gold trading.
3. Trading Strategy Principles
3.1 Dual Moving Average Trend Following
The signal core of Goldspeed Scalper is two Exponential Moving Averages (EMA)—a fast line with period 9 and a slow line with period 21. Compared with the Simple Moving Average (SMA), EMA assigns greater weight to recent prices and reacts faster to trend changes, making it very suitable for short-term trading.
Long condition: when the fast line is above the slow line (EMA9 > EMA21), the market is in a bullish alignment and the short-term price center of gravity has moved up, triggering a buy signal. Short condition: when the fast line is below the slow line (EMA9 < EMA21), a bearish alignment is indicated, triggering a sell signal.
The product uses a "trend continuation" rather than a "wait-for-crossover" entry method: it can enter as long as the moving-average alignment holds, without waiting for that exact golden-cross or death-cross candle. The advantage is avoiding long periods out of the market in a one-sided trend because the crossover has long passed, significantly improving the signal capture rate. At the same time, all signals are calculated from closed candles (using shift=1 and shift=2 data) rather than the currently moving candle, which mechanically eliminates future functions and ensures backtest results are highly consistent with live behavior.
3.2 RSI Momentum Filter (Optional)
To further optimize entry quality, the EA integrates an RSI (Relative Strength Index) filter. For longs, RSI is required to be in the 45–72 range to avoid chasing longs in overbought territory; for shorts, RSI must be in the 28–55 range to avoid chasing shorts in oversold territory.
However, in sharp one-sided rallies or sell-offs in gold, RSI stays in overbought or oversold territory for a long time, and the filter would actually block trend-following orders. Therefore this EA designs the RSI filter as an optional feature, disabled by default (UseRsiFilter=false). This captures one-sided moves while leaving a switch for users who need stricter filtering.
3.3 ATR Dynamic Stop-Loss and Take-Profit
Fixed-point stop-loss and take-profit perform very differently under different volatility environments: too wide in calm markets, too narrow in volatile markets. Goldspeed Scalper uses ATR (Average True Range, period 14) to dynamically calculate risk distances: default stop-loss distance = 1.5 × ATR, default take-profit distance = 1.0 × ATR.
When volatility rises, ATR increases and the stop-loss/take-profit automatically widen to avoid being swept out by noise; when the market is calm, the distances narrow and capital efficiency improves. This adaptive characteristic keeps a reasonable risk-reward structure across different market phases.
3.4 Optional Trailing Stop
The EA includes a trailing stop function: it activates once floating profit reaches 1.0 × ATR and follows in steps of 0.3 × ATR to gradually lock in profit. For the sake of passing Market verification, this function is disabled by default. Experienced users may enable it manually in live trading; once enabled, the EA still performs stops level / freeze level validation to ensure every modification request is legal.
4. Three-Layer Risk Control System
4.1 Layer One: Margin Adaptation
Before every order, the EA calls OrderCalcMargin to precisely calculate the required margin. If it exceeds 80% of available margin, the lot size is automatically reduced to an affordable level; if even the symbol's minimum lot is not satisfied after reduction, the trade is simply skipped and the doomed order is never submitted. This mechanism solves the compatibility problem between small-account verification and large-account lot settings—MQL5 Market verification accounts usually hold only a few hundred dollars, while 0.2 lots of gold requires about 400 dollars in margin. Without this protection, orders would be rejected with [No money], causing verification to fail.
4.2 Layer Two: Hard Risk Cap
Margin checking alone is not enough: with 0.01 lot of gold under a 1.5 × ATR stop-loss, the maximum loss of a single trade can still reach tens of dollars; for a small account, a few consecutive stop-outs trigger a blow-up. For this reason, the EA adds a hard risk cap (MaxRiskPercent, default 2%): it calculates the worst-case loss from the stop-loss distance and forcibly compresses the lot size if it exceeds 2% of account balance; if even the minimum lot exceeds the cap, the trade is abandoned. This guarantees that no matter how large a lot parameter the verifier injects, the account cannot blow up from a single trade.
4.3 Layer Three: Relative Spread Filter
Gold spreads vary enormously across brokers and time sessions. A fixed point threshold (such as 60 points) is converted to 240 points on three-decimal XAUUSDm quotes and would block all orders by mistake. Goldspeed Scalper uses relative judgment: an order is allowed only if the spread amount does not exceed 30% of ATR (MaxSpreadAtrPct, default 30%), making it universal across symbols. The diagnostic panel shows the current spread in dollars and its percentage of ATR in real time for easy monitoring.
5. Core Features
One position, one result: only one position is kept per symbol and per magic number; no adding, no averaging down, no hedging. When a reverse signal appears, positions are closed ticket by ticket, never in bulk that could mistakenly close other strategies' orders. Every trade is independently traceable and performance analysis is clear.
Completely transparent: the source code is fully open, with no hidden calls, no remote loading, and no binary encryption; all indicators are MT5 built-ins and users can review them line by line in MetaEditor.
Verification-friendly: systematic handling of common MQL5 Market automated verification errors—trailing stop disabled by default, stop-loss modification validation (stops level / freeze level), 15-second modification throttling, margin adaptation, hard risk cap, and relative spread filtering. The compiled build has 0 errors / 0 warnings, uses X64 Regular architecture, and contains no native code.
Real-time diagnostic panel: the upper-left corner of the chart displays status, fast/slow EMA values, RSI, ATR, spread, buy/sell signals, balance/equity, and an AutoTrading reminder. When no orders are placed, one glance shows which step is blocking, greatly lowering the barrier to use.
6. Parameter Configuration
The EA provides clearly grouped input parameters: signal parameters include FastEmaPeriod (9), SlowEmaPeriod (21), RsiPeriod (14), UseRsiFilter (default false), and RSI ranges; risk parameters include SlAtrMultiplier (1.5), TpAtrMultiplier (1.0), MaxRiskPercent (2%), and AutoShrinkLot (true); lot parameters include UseRiskPercent, RiskPercent, FixedLot (0.01), and MaxSpreadAtrPct (30%); trading controls include MagicNumber (241117), StartHour / EndHour, and UseTrailingStop (default false); and the display parameter is ShowDebugPanel (default true). The parameters balance generality and optimizability, so users can adjust them flexibly according to account size and risk preference.
7. Installation and Usage
Place the .ex5 file into the MQL5/Experts/ folder under the MT5 installation directory, restart MT5 or press Ctrl+N to refresh the Navigator, drag the EA onto an XAUUSD H1 chart, and confirm the AutoTrading button is green (enabled). For first use, always run on a demo account; observe the diagnostic panel to confirm signals are normal and spreads are reasonable before considering a live account.
8. Risk Warning and Disclaimer
Goldspeed Scalper is a technical tool and does not guarantee any returns. Trend-following strategies are prone to repeated stop-outs in ranging markets, and ATR stop-loss cannot fully avoid extreme market risk. Gold margin trading carries high leverage risk; please use it only after fully understanding the strategy logic, completing historical backtests, and applying sound money management, and invest only capital you can fully afford to lose. Past performance does not represent future results.
