YoForexEA
HOMEBLOGDOWNLOADSSIGNALSABOUTCONTACT
Log InSign Up

GET NEW EAs BEFORE EVERYONE ELSE

Subscribe to our newsletter for exclusive releases, trading tips, and market insights.

YoForexEA

Your trusted source for premium Expert Advisors and trading robots for MetaTrader 4 & 5.

PRODUCTS

  • All Expert Advisors
  • Gold EAs
  • Scalping EAs
  • Grid Trading Bots
  • AI Trading Bots
  • Prop Firm EAs

RESOURCES

  • Installation Guides
  • MT4 vs MT5 Guide
  • Recommended Brokers
  • VPS Providers
  • Updates & Changelog
  • FAQ

LEARN TRADING

  • Risk Management
  • Backtesting Guide
  • EA Optimization
  • Trading Psychology
  • Forex Glossary

COMPANY

  • About Us
  • Contact
  • Premium Shop
  • Affiliate Program
  • Submit an EA

LEGAL

  • Terms of Service
  • Privacy Policy
  • Risk Disclosure
  • Refund Policy
support@yoforexea.com

150+

Expert Advisors

50K+

Downloads

98%

Satisfaction Rate

24/7

Support Available

© 2026 YoForexEA. All rights reserved.

Supports:
MT4MT5

Trading forex involves significant risk and may not be suitable for all investors. Past performance is not indicative of future results.

All Bots

TABLE OF CONTENTS

OverviewStrategyRecommended SettingsRisk ManagementHow to Install

QUICK LINKS

→ Gold EAs→ Scalpers→ Grid Bots→ MT4 EAs→ MT5 EAs
  1. Home
  2. /Blog
  3. /XAUUSD M5 Super Scalper
  4. /XAUUSD M5 Super Scalper EA MQ4 Source Code
XAUUSD M5 Super ScalperMT4V1.0

XAUUSD M5 Super Scalper EA MQ4 Source Code

SEP 5, 2025•7 MIN READ
4.5(83 reviews)
XAUUSD M5 Super Scalper EA MQ4 Source Code
5,818 downloads

PROS

  • Low drawdown design
  • Prop firm compatible
  • Easy to configure
  • Regular updates

CONS

  • Requires VPS for best results
  • Needs low spread broker
  • Not for beginners

Gold moves fast, especially on M5. That can be a blessing… or a blender. XAUUSD M5 Super Scalper EA gives you the full MQ4 source code for a disciplined scalper that fires only when momentum, volatility, and execution costs line up. No martingale, no grid, no “hope & hold.” Just a lean, well-commented codebase you can audit, customize, and extend.

Below you’ll get the whole picture: what’s inside the source, the entry/exit logic, recommended settings, how to compile and deploy, where to tweak parameters in code, backtest notes, risk playbook, FAQs, and copy-paste meta data for your CMS.

What You Get (At a Glance)

  • Complete MQ4 source (heavily commented; clean sections for Signals, Risk, and Orders)
  • Session-aware scalping (NY/London focus; optional Asia mute)
  • Spread/slippage guards (instant veto when costs spike)
  • ATR-aware stops (dynamic SL sizing so you don’t trade bad math)
  • Two micro-entry models (breakout & pullback “snap”) you can enable/disable
  • Partial TP & trailing (trail only after +1R to avoid noise churn)
  • Equity guard & daily stop (auto-pause new entries after a rough patch)
  • Magic/Comment routing for neat multi-chart, multi-symbol deployments
  • Light add-to-winner option (scale into strength only; never average down)
  • Verbose logging (exact reasons for entries, exits, vetoes)

Architecture & Code Map (MQ4)

Inputs & Presets

  • extern params for risk %, ATR multipliers, spread/slippage caps, session window, news buffer, entry mode toggles, partials, trailing, MagicNumber.
  • Profiles: Conservative M15, Standard M5, Cost-Aware XAUUSD M30.

Init/Deinit (OnInit, OnDeinit)

  • Validates broker digits / tick size / min stop distance.
  • Logs environment, confirms permissions (DLL if you enable your own news lib).

Signals Module (GetSignal())

  • Directional bias via a medium/slow MA blend + momentum nudge.
  • ATR gate: skips when implied SL is too wide or tiny.
  • Micro-structure:
  • Breakout: decisive close past micro level with follow-through.
  • Pullback: rejection into a trend zone, then strong confirmation candle.
  • Execution checks: spread ≤ cap, recent slippage estimate ≤ cap, session OK.

Risk & Sizing (CalcLotsByRisk())

  • Positions sized by % of equity against ATR-based SL distance.
  • Safeguards for min lot, lot step, max exposure.

Orders & Lifecycle

  • Enter with OrderSend; place SL/TP instantly; confirm/repair if partial fills.
  • Partial TP at +1R (configurable), move to BE+ then trail (ATR/swing).
  • Optional add-on only on fresh confirmation if exposure allows.
  • Daily loss stop / Equity guard pause new entries; can close all on trigger.

Utilities : Spread/point converters, ATR wrapper, time/session helpers, error-aware OrderModify, pretty logs.

Strategy Logic — Designed for Gold on M5

1) Direction First (don’t fight the flow)
A medium+slow MA baseline + momentum read decides if longs or shorts are even allowed.

2) ATR Gate (don’t trade bad math)
SL sized at 1.3×–2.0× ATR (scalper range). If SL would be absurdly wide/tiny, the trade is skipped.

3) Micro-Confirmation (proof > prediction)

  • Breakout mode: decisive close through a micro level with acceptable spread snapshot.
  • Pullback mode: rejection wick into trend zone, then a strong follow-through close.

4) Lifecycle (earn the right to trail)

  • Partial at +1R (lock some), move to BE+, then trail the remainder behind ATR or the last micro swing.
  • Optional light add-on when a new confirmation appears—winners only.

5) Hard Stops (protect the day/week)

  • Daily loss stop (e.g., 2–3%).
  • Equity guard (floating drawdown cap).
  • Spread/slippage veto before entry; auto-pause when conditions turn hostile.

Recommended Settings (Starter Template)

Environment

  • Broker: ECN/Raw spread with stable XAUUSD liquidity
  • VPS: Yes (latency matters for scalps)
  • Leverage: 1:200–1:500 (use responsibly)

Symbols & Timeframes

  • Primary: XAUUSD M5
  • Optional: M15 (calmer) or M30 if costs are chunky

Risk Controls

  • Risk per trade: 0.25%–0.5% (start 0.3%–0.4%)
  • Max concurrent trades: 3–4 (all charts)
  • Daily loss stop: 2%–3% (auto-pause until next session)
  • Equity guard: 5%–6% floating DD (pause new entries)

Execution Filters (typical caps)

  • Max spread: 35–50 points (depends on quoting)
  • Max slippage: 1–2 points
  • Sessions: Focus NY & London overlap; avoid rollover
  • News buffer: 10–15 min around CPI/NFP/FOMC (code has a simple timer hook; plug your own news feed if you like)

Stops & Targets

  • SL: 1.3×–2.0× ATR or beyond last micro swing
  • TP: 1.2R–1.6R baseline; partial at +1R, then trail

Ready-Made Profiles (Inputs you can ship with)

A) M5 Conservative

  • Risk 0.3% | SL 1.7× ATR | TP 1.4R | partial +1R → ATR trail
  • Spread cap moderate; both entry modes ON

B) M5 Standard

  • Risk 0.4% | SL 1.6× ATR | TP 1.4R–1.5R | BE+ after partial
  • Slightly tighter spread/slippage caps; pullback favored

C) M15 Cost-Aware

  • Risk 0.35% | SL 1.8× ATR | TP 1.5R | swing-based trail
  • Wider news buffer; add-on OFF first week

How to Install, Compile & Run (MT4)

  1. Copy XAUUSD_M5_Super_Scalper.mq4 into MQL4/Experts/.
  2. Open MetaEditor, compile (F7). Fix any broker-specific warnings you see.
  3. Restart MT4 → Navigator → Experts → confirm EA is listed.
  4. Enable AutoTrading (toolbar).
  5. Attach the EA to XAUUSD M5 (one symbol per chart).
  6. Load Conservative/Standard preset or set inputs manually.
  7. Demo forward-test for 7–14 days across your session(s) to validate costs and fills.

Customizing the Code (Where to Tweak)

  • Inputs block: change default risk %, ATR multipliers, spread/slippage caps, session times, partials, trailing, add-on toggle.
  • GetSignal(): adjust breakout/pullback thresholds, candle strength rules, permitted level distance.
  • CalcLotsByRisk(): edit rounding for brokers with quirky lot steps.
  • Trailing module: switch between ATR vs. swing; edit step distance and trigger R level.
  • Guards: tune daily loss %, equity DD %, and behavior (pause vs. close-all).

Backtesting & Profiling (Gold-Specific Notes)

  • Use tick-by-tick data with variable spread; fixed spreads make scalpers look unrealistically smooth.
  • Include event windows (CPI/NFP/Fed) in your notes—even if you block them live—to gauge slippage risk.
  • Measure net edge after costs (spread + commission + avg slippage). If costs eat >35–45% of gross R, move up to M15 or tighten filters.
  • Walk-forward mindset: lightly tune on Period A, test on Period B. Over-fit code breaks fast.
  • Log skipped trades (spread veto, ATR gate, session closed). Those logs explain performance.

Risk Playbook (Print This)

  • Tiny, steady risk (0.25%–0.5%) beats hot-and-cold sizing—always.
  • Circuit breakers (daily stop & equity guard) are non-negotiable.
  • Costs rule scalpers: if spreads/slippage climb, pause or step up timeframe.
  • Don’t chase news; your edge is structure + cost control, not heroics.
  • Withdraw periodically (if live) so effective risk stays sane as equity grows.

FAQs

Is this a full EA or just a snippet?
A full EA with complete MQ4 source—compile, run, and customize.

Does it martingale or grid?
No. The only “scaling” is optional add-to-winner on fresh confirmation, capped by exposure rules.

Can I adapt it to FX pairs?
Yes; change symbol-specific caps (spread/slippage), ATR multipliers, and session windows. M5/M15 on majors is a good start.

Prop-firm friendly?
It includes daily loss and equity guard features plus partials/breakeven. Still, respect your prop’s exact rules.

Will it trade every session?
No. It’s designed to skip poor conditions (dead ranges, hostile costs). That restraint is part of the edge.

Disclaimer

Trading Forex/CFDs—especially XAUUSD—involves risk. Past performance is not indicative of future results. Test on demo, keep risk conservative, and never trade capital you can’t afford to lose.

Call to Action

Want a transparent gold scalper you can read, modify, and ship? Grab the XAUUSD M5 Super Scalper EA (MQ4 source), compile it, and run the M5 Conservative profile on demo for a week. When fills and behavior look steady, start dialing in your own rules—tight risk, clear logs, clean execution.

Happy Trading

Related Tags

#XAUUSD M5 Super Scalper#MT4#Forex Robot#Automated Trading

READY TO TRADE WITH XAUUSD?

Download now and start your automated trading journey

S

Sayan

We review and share the best Expert Advisors and trading robots for MetaTrader platforms.

View Profile

POPULAR EAs

1

Unleash the Tokyo Sniper USDJPY MT4 EA V1.0: Your Urgent Ticket to Forex Domination!

MT4 • Expert Advisor
2

TT2025 EA MT4: The Imminent Trading Revolution You Cannot Afford to Ignore!

MT4 • Expert Advisor
3

Boring Pips MT4: The Dreadfully Dull Path to Forex Riches That Will Shock Your Portfolio!

MT4 • Expert Advisor
4

Woody Mart MT5: Ignite Your Trading Empire Before It's Too Late!

MT4 • Expert Advisor
5

ZENJY FX ROBOT PROP FIRM EA V5.0 MT5: The Ultimate Forex Frenzy You've Been Waiting For!

MT4 • Expert Advisor
6

GembalaADX Trend Following EA MT5: The Mock-Epic Forex Savior You've Been Desperately Awaiting!

MT4 • Expert Advisor

GET NEW EAs FIRST

Subscribe to get notified about new Expert Advisors

Risk Warning: Trading involves risk. Past performance is not indicative of future results.