XAU Momentum Engine
- Uzmanlar
- Sürüm: 1.0
- Etkinleştirmeler: 5
XAU Momentum Engine
XAU Momentum Engine is a fully automated Expert Advisor for MetaTrader 5, built for traders who want a structured and controlled approach to XAUUSD trading.
The system combines two independent strategies inside one Expert Advisor:
- Range-Compression Scalping
- Opening Range Breakout (ORB)
Both strategies run through a shared execution framework that focuses on:
- controlled trade execution,
- configurable position sizing,
- broker-side validation,
- position recovery,
- and portfolio protection.
This product is designed for traders who want more than simple entry signals.
It is built to manage the full trade cycle: from signal generation, to execution checks, to monitoring open positions and controlling risk.
Main Strategy Modules
1) Range-Compression Scalping
This module looks for tight market consolidation and then waits for a breakout.
How it works:
- Builds a recent price range from the last configurable number of bars
- Compares that range with an ATR filter
- If the range is sufficiently compressed, the market is considered ready for a breakout
- A BUY trade can be opened when price breaks and closes above the range high
- A SELL trade can be opened when price breaks and closes below the range low
- Stop-loss is placed beyond the opposite side of the range with a configurable buffer
- Take-profit is calculated using a configurable risk-reward ratio
Goal:
To capture fast directional movement after a compressed market phase.
2) Opening Range Breakout (ORB)
This module tracks the opening range of a session and waits for a breakout after that range is established.
How it works:
- Builds the opening range from the first configurable number of bars
- Locks the ORB high and ORB low after the range is complete
- Waits for a candle close outside the range
- Opens a breakout trade in the direction of the move
- Supports optional re-entry only after stop-loss
- Includes a maximum trades per day control
- Includes a maximum hold bars setting for position timeout management
- Session start time and session shift are configurable
Goal:
To participate in directional moves that develop after the session opening structure is formed.
Shared Execution Framework
Both trading modules use the same protective execution layer.
Execution logic includes:
- spread check before sending a trade
- stop-loss / take-profit validation
- lot calculation
- margin check
- trade submission and fill verification
- optional take-profit re-anchoring based on actual fill price
- position synchronization and tracking
This helps reduce weak or invalid trade requests before execution.
Position Sizing Options
The EA supports two position sizing modes:
Fixed Lot Mode
You can define fixed lot size separately for:
- Scalping strategy
- ORB strategy
Risk % Mode
You can let the EA calculate position size based on:
- account equity
- stop-loss distance
- your configured risk percentage
This gives flexibility for different account sizes and trading styles.
Risk Controls and Safety Features
XAU Momentum Engine includes multiple built-in safety layers.
Key protections:
-
Maximum spread filter
Prevents new trades when spread is higher than your allowed limit. -
Broker stop validation
Checks whether stop-loss and take-profit levels are acceptable for the broker. -
Margin reserve protection
Helps keep a free-margin reserve before opening a new trade. -
Execution verification
Confirms trade result and tracks the actual executed position. -
Optional TP re-anchoring
Recalculates take-profit from the actual fill price to better preserve intended risk-reward geometry. -
Verbose diagnostics
Detailed logging for monitoring behavior and troubleshooting.
Portfolio Guard
The Expert Advisor also includes a portfolio-level protection system.
Floating Loss Guard
The EA can monitor the combined floating result of its strategy positions and trigger a protection response when a configured drawdown threshold is reached.
Trading Lock
When the protection condition is triggered, the EA can:
- stop taking new trades,
- close tracked positions,
- and lock trading activity.
Auto Unlock
The system can automatically unlock trading on the next broker server day if enabled.
This helps add an additional risk layer beyond individual trade stop-loss levels.
Recovery and Continuity
The EA is built with state recovery functions to help maintain continuity after terminal restart or VPS interruption.
Recovery features include:
- recovering open position state
- restoring scalping position tracking
- recovering ORB session state
- restoring ORB trade history for the current session
- maintaining separate internal state for the two strategy modules
This is especially useful for automated environments where platform restarts may occur.
Main User Inputs
Master Switches
- Enable Scalping
- Enable ORB
- Require Hedging Account
Position Sizing
- Fixed lot mode
- Risk percent mode
Scalping Settings
- Timeframe
- Range bars
- ATR period
- Compression multiplier
- Risk-reward ratio
- Stop-loss buffer
ORB Settings
- Timeframe
- Opening range bars
- Risk-reward ratio
- Stop-loss buffer
- Maximum hold bars
- Maximum trades per day
- Re-entry only after stop-loss
- Session start hour
- Session start minute
- Session shift minutes
Execution Safety
- Deviation points
- Maximum spread
- Re-anchor TP to fill
- Margin reserve %
Portfolio Guard
- Enable floating-loss guard
- Loss guard %
- Auto unlock next day
Diagnostics
- Verbose logging
Best Use
XAU Momentum Engine is designed primarily for traders who want:
- an automated trading workflow,
- a dual-strategy structure,
- configurable risk handling,
- and built-in execution protection.
It is especially suitable for users who want one EA that can combine:
- breakout-based scalping logic,
- session breakout logic,
- and portfolio-level control tools.
Important Notes
- Designed for MetaTrader 5
- Intended for automated XAUUSD trading
- A hedging account may be required or recommended depending on your configuration and how you use both strategy modules together
- Always test settings in the Strategy Tester and on a demo account before live trading
- Trading involves risk
Disclaimer
This Expert Advisor is a trading tool, not a guarantee of profit.
Market conditions change, and past performance does not guarantee future results.
Use responsible risk management at all times.
(agar MQL5 me compact version chahiye)
XAU Momentum Engine is a MetaTrader 5 Expert Advisor for automated XAUUSD trading.
It combines Range-Compression Scalping and Opening Range Breakout (ORB) with configurable lot sizing, execution safety checks, position recovery, and portfolio protection tools.
(Description me alag se bullet section rakhna ho to)
Key Features
- Dual-strategy architecture
- Range-Compression Scalping
- Opening Range Breakout (ORB)
- Fixed lot and risk % position sizing
- Maximum spread filter
- Stop-loss / take-profit validation
- Margin reserve checks
- Fill verification
- Optional TP re-anchoring
- Portfolio floating-loss guard
- Trading lock and auto unlock
- Position and session recovery
- Separate strategy tracking via magic numbers
- Detailed diagnostics log
