If you’re hunting for a clean, editable MQL4 codebase to scalp XAUUSD on the M5 timeframe, this is it. XAUUSD M5 Super Scalper EA (Source Code MQ4) is a lightweight, modular expert advisor designed for rapid execution, tight risk, and practical guardrails (spread, slippage, news pause windows, time filters). It’s engineered as a framework you can trade as-is or extend with your own logic—no mysterious black boxes, no hidden DLLs, just readable MQ4.


You’ll find the full breakdown below: architecture, inputs, signal logic, risk controls, recommended baseline settings, compile/installation steps, backtesting workflow, prop-friendly tips, troubleshooting, and a straight-copy metadata block for your CMS.


What This EA Is (and Isn’t)


It is:



  • A gold-focused scalping EA for M5 (and optionally M1/M15 after testing)

  • Open MQ4 source code, structured for clarity and speed

  • Equipped with strict execution filters (spread, slippage, time windows), ATR-aware stops, partial TP, breakeven, and optional trailing

  • Ready to run on ECN/Raw brokers with fast fills and low latency (VPS recommended)


It isn’t:



  • A martingale/grid “rocket”—no forced averaging.

  • A magic money printer. It’s a disciplined scaffold; your risk and broker conditions still matter.


Why XAUUSD on M5?


Gold (XAUUSD) is liquid and moves with personality during London and New York. M5 strikes a balance: fast enough to catch bursts, but not so noisy that costs dominate. This EA watches micro-momentum shifts and mean-reversion taps into intraday value, entering only when costs and volatility line up.



Key Features (Quick Scan)



  • Pure MQ4 Source — neatly commented functions, easy to extend.

  • Cost GatesMaxSpread and MaxSlippage checks to avoid expensive fills.

  • Session Filter — trade only during your configured hours (e.g., London/NY).

  • News Pause Window (Manual Time Slots) — optional pre/post event cooldowns.

  • ATR-Aware Stops — dynamic SL/TP sized to conditions (or fixed pip mode).

  • Breakeven & Partial TP — bank early gains; reduce variance in chop.

  • Optional Trailing — modest trailing when moves extend.

  • Hard Equity Guard — daily loss limiter stops new entries.

  • Unique Magic Numbers — multi-pair/multi-chart safe.

  • Clear Comments & Logging — quick audits for every fill.


Strategy Logic (Plain English)



  1. Quality Gate: Only trade if spread ≤ MaxSpread, estimated slippage ≤ MaxSlippage, and time is inside your session window.

  2. Bias: Micro-trend check using fast/slow EMAs and recent candle structure (e.g., higher-lows in up bias).

  3. Trigger:

  4. Momentum poke: break of minor structure with a volatility buffer, or

  5. Value tap: pullback to a short EMA zone with rejection.

  6. Risk & Orders: Position size by Risk% (ATR or fixed pip-stop). Send a single market order with a real SL/TP.

  7. Management: Move to breakeven after X pips or % of ATR; partial close at first milestone; optional trailing for runners.

  8. Equity Guard: If daily loss cap hits, EA pauses new trades for the rest of the day.


Code Architecture (Fast Tour)



  • OnInit() — preflight checks; cache symbol specs (digits, point size, tick value); compute handles if you use iATR/iMA.

  • OnTick() — one early-return funnel:



  1. Trade allowed? (AutoTrading, symbol trade, session time)

  2. Costs ok? (Spread ≤ MaxSpread, slippage estimate ok)

  3. Open risk ok? (Daily loss under cap; no conflicting positions)

  4. Signal? (EMA bias + trigger with ATR buffer)

  5. Size & Send — risk-based lot calc, OrderSend with SL/TP

  6. Manage — breakeven/partial/trailing for open position(s)



  • HelpersGetATR(), SpreadOK(), RiskLot(), WithinSession(), DrawdownExceeded(), ManageOpenPosition()

  • OnDeinit() — tidy up, remove objects/labels.



Installation & Compile (Step-By-Step)



  1. Copy Source: Place XAUUSD_M5_Super_Scalper_EA.mq4 into MQL4/Experts.

  2. Compile: Open MetaEditor, compile (F7). Fix any broker-specific warnings (digits/points).

  3. MT4 Refresh: Restart MT4 or right-click Navigator → Experts → Refresh.

  4. Attach to Chart: Open XAUUSD M5, drag the EA on.

  5. Set Inputs: Start with the baseline below; adjust for your broker.

  6. Enable AutoTrading and confirm a smiling face on the chart.

  7. VPS: For scalping gold, a <20ms VPS to your broker is strongly recommended.


Baseline Settings (Safe Starters)



  • Session: Focus London/NY (your broker time ~ Start 11 – End 22 as a starting point).

  • Risk: 0.3%–0.6% per trade until you have 3–4 weeks of forward results.

  • Stops/Targets: ATR_SL=1.2, ATR_TP=1.4 (tight but realistic for gold bursts).

  • Breakeven: Trigger around 0.8R–1.0R.

  • Partial TP: 50% at first target; let remainder aim for full TP or trail modestly.

  • Costs: Keep MaxSpreadPoints strict at first. Relax only if your live costs are consistently clean.

  • Concurrency: 1 position at a time at the start.


Backtesting & Forward Testing (Do It Right)


Backtest



  • Use tick data with variable spread and realistic commission.

  • Test 12–18 months, including volatile periods.

  • Match session hours to your forward plan.

  • Fix risk at 1% for apples-to-apples across tweaks.


Evaluate



  • Max Drawdown and consecutive losses (can you sit through them?).

  • Profit Factor > 1.25–1.35 with realistic costs is typically workable on gold scalps.

  • Expectancy stable across sub-periods; not just one lucky month.


Forward Test



  • Run micro lots on a small live account or cent account for 2–3 weeks.

  • Compare live spreads/slippage vs backtest assumptions; tighten gates if live is worse.


Prop-Friendly Tips



  • Set EA DailyLossLimit below the firm’s daily rule (e.g., 3% vs their 5%).

  • Keep Risk% conservative (0.3%–0.6%).

  • Avoid stacking correlated risk around top-tier US news (CPI, NFP, FOMC).

  • Consistency over thrill. Pass first, scale later.


Troubleshooting



  • No trades? Session window, spread gate, or volatility may be blocking—check journal comments on each tick.

  • BE cutting winners early? Push BE trigger later or rely on partial TP.

  • Too many micro-losses? Slightly widen ATR_SL or raise the quality threshold (e.g., bigger ATR buffer).

  • Digits confusion on gold? Verify Digits/Point and re-tune Points vs Pips inputs.

  • Conflicts with other EAs? Use a unique Magic and, if needed, an Order Comment filter.


FAQ


Can I run it on M1 or M15?
Yes, but re-opt your stops/targets and cost gates. M1 is spread-sensitive; M15 trades less often.


Does it hedge or average in?
No by default. It’s a single-entry framework. Add safety-adds only if you cap them tightly (not recommended for prop rules).


Will it work on other pairs?
This scaffold is tuned for XAUUSD. You can adapt it, but test thoroughly—other symbols have different microstructure.


Do I need a VPS?
For gold scalping: yes. Latency matters.


Risk Disclaimer


Trading Forex/CFDs involves substantial risk. Past performance does not guarantee future results. Only trade money you can afford to lose. Always validate on demo or tiny live lots before scaling.


Call to Action


Ready to build on a fast, readable MQ4 scaffold? Download the XAUUSD M5 Super Scalper EA Source Code, compile it, and start with the baseline profile. Backtest honestly, forward test patiently, then tune with small, data-driven changes. Keep risk tight—let the edge do the compounding.


Download: Add your fxcracked.org source-code link here (match the slug below for SEO).
Support: Drop questions in your blog comments or your usual support channel.


Happy Trading