Moon Sniper Execution
- Uzmanlar
- Umer Shahzad
- Sürüm: 1.0
- Etkinleştirmeler: 20
// ===================== INPUTS ===================== input bool InpValidationPatch = true; // FALSE FOR USE EA input group "---- GENERAL SETTINGS ----" input double LotSize = 0.01; input int MagicNumber = 5555; input int MaxSpread = 500; input int Slippage = 1000; input int TradeLockMinutes = 0; input int BE_Profit_Points = 500; // FIX #8: Separate grid step tolerance from order slippage // On XAUUSD Daily, EntryStep is large so a tight tolerance is needed. // This replaces the old Slippage-as-buffer approach in ManageGrid. input int GridStepTolerance = 1000; // Points: how far past the step is still valid for entry input group "---- TIME FILTER (SERVER TIME) ----" input bool UseTimeFilter = true; input int StopHour_Server = 20; input int StopMinute_Server = 50; input int StartHour_Server = 22; input int StartMinute_Server = 2; input bool CloseAllOnStop = true; input group "---- EMA CROSSOVER ACTIVATION ----" input bool UseEMACrossover = true; input int EMA_Fast_Period = 30; input int EMA_Slow_Period = 80; input ENUM_TIMEFRAMES EMA_Crossover_TF = PERIOD_CURRENT; input double CrossoverObsZone = 8000; // Points price must travel after crossover to confirm input bool UseEMAFilter = false; // Legacy directional EMA filter input int EMA_Period = 50; input ENUM_TIMEFRAMES EMA_Timeframe = PERIOD_CURRENT; input group "---- SLOW MODE SETTINGS ----" input double EntryStep_Slow = 3000; input double FixedSL_Slow = 3000; input double TrailStart_Slow = 3000; input double TrailDist_Slow = 5300; input int TrailStep_Slow = 500; input double BreakEven_Slow = 2500; input int MaxTrades_Slow = 5; input bool GridOn_Slow = true; input int SpeedWindow_Slow = 3; // seconds input int LockDuration_Slow = 0; input double Threshold_Slow = 700.0; input int GridDuration_Slow = 900; input group "---- MEDIUM MODE SETTINGS ----" input double EntryStep_Medium = 3000; input double FixedSL_Medium = 3000; input double TrailStart_Medium = 3000; input double TrailDist_Medium = 5300; input int TrailStep_Medium = 500; input double BreakEven_Medium = 3000; input int MaxTrades_Medium = 6; input bool GridOn_Medium = true; input int SpeedWindow_Medium = 3; input int LockDuration_Medium = 1200; input double Threshold_Medium = 1200.0; input int GridDuration_Medium = 1200; input group "---- FAST MODE SETTINGS ----" input double EntryStep_Fast = 3000; input double FixedSL_Fast = 3000; input double TrailStart_Fast = 3000; input double TrailDist_Fast = 5300; input int TrailStep_Fast = 500; input double BreakEven_Fast = 3000; input int MaxTrades_Fast = 7; input bool GridOn_Fast = true; input int SpeedWindow_Fast = 3; input int LockDuration_Fast = 1500; input double Threshold_Fast = 1600.0; input int GridDuration_Fast = 1500;
🌙 MOON SNIPER
Expert Advisor for MetaTrader 5
XAUUSD — Dual-Side Stop Grid + Trailing Breakeven System
| Version 1.00 | Symbol XAUUSD | Magic Number 220125 |
==============MUST SET AS FALSE IN INPUTS BEFOR TRADING DO NOT IGNOR==========
1. Overview & Description
MOON SNIPER is a fully automated Expert Advisor (EA) for MetaTrader 5, engineered specifically for the XAUUSD (Gold) market. It employs a dual-side pending order grid strategy, placing Buy Stop orders above price and Sell Stop orders below price simultaneously, then managing each triggered position with a precision breakeven and trailing stop mechanism.
The strategy is built around the premise that during high-momentum market moves, Gold will break decisively in one direction. By pre-positioning pending orders on both sides of the market, MOON SNIPER is set to capture whichever breakout occurs. Once the winning side triggers, the losing side is cancelled automatically, and the EA focuses entirely on protecting and maximising the open trades.
1.1 Core Philosophy
- Momentum Capture: Wait for the market to come to the orders, never chase price.
- Asymmetric Protection: Aggressive trailing once breakeven is reached — never give back significant gains.
- Intelligent Filtering: Speed and time filters prevent the grid from firing during slow, choppy conditions or outside optimal trading hours.
- Fully Autonomous: No manual intervention required once configured. The EA manages the entire trade lifecycle from placement to closure.
1.2 How It Works — Cycle Overview
Each complete run of the EA follows a defined cycle:
| STEP 1 | Speed & time filters are checked. If conditions are met, the grid is placed: N Buy Stop orders above price and N Sell Stop orders below price, each separated by the configured grid spacing. |
| STEP 2 | Each order that triggers (i.e., price reaches it) becomes an open position with a fixed stop loss already attached. |
| STEP 3 | As each position gains profit, the EA first moves the stop loss to breakeven, then begins trailing to lock in gains. |
| STEP 4 | The moment one side (Buy or Sell) is fully complete — meaning all its pending orders and open positions are gone — the EA cancels all remaining opposite-side orders and resets for a new cycle. |
| STEP 5 | If the maximum trigger count on either side is reached, or all trades close, the cycle resets automatically. |
2. Installation & Setup
2.1 Requirements
- MetaTrader 5 (build 2755 or later recommended)
- XAUUSD symbol available on your broker (may be labelled GOLD or XAU/USD)
- EA trading enabled in MT5 settings (Tools → Options → Expert Advisors → Allow Automated Trading)
- Sufficient free margin for the configured lot size and grid steps
2.2 Installation Steps
- Copy the MOON SNIPER .ex5 file into your MT5 data folder: MQL5\Experts\
- Restart MetaTrader 5, or right-click the Navigator panel → Refresh.
- Open a XAUUSD M1 or M5 chart (the EA is tick-driven and works on any timeframe, but M1/M5 is recommended for clean visual monitoring).
- Drag MOON SNIPER from the Navigator panel onto the chart.
- Configure all parameters in the EA settings dialog (see Section 3).
- Ensure "Allow Automated Trading" is checked in the EA dialog.
- Click OK. The EA will initialise and display a live status comment on the chart.
MOON SNIPER is an EMA crossover-based grid scalping strategy designed for fast intraday market movements.
The system combines dynamic EMA trend detection with controlled grid execution to capture short-term momentum opportunities.
It is optimized for high-frequency scalping environments while maintaining structured trade management logic.
Recommended timeframes are M1, M5, and M15 for the best balance between signal frequency and market precision.
| 💡 TIP — Recommended Broker Conditions |
| For best performance, use a broker with raw spread or ECN accounts on XAUUSD. |
| A typical XAUUSD spread should be under 300–400 points during London/New York sessions. |
| The EA's spread filter (InpMaxSpreadPts) will automatically pause the grid if spread widens. |
