MetaTrader 5 Expert Advisor v3.00

SniperEA Pro

Precision Multi-Indicator Scalping System with Advanced Risk Management

Scalping Trading Style
M5 / H1 Timeframes
Low-Medium Risk Level
Multi-Symbol Markets

Overview

What It Does

SniperEA Pro is a sophisticated multi-indicator scalping system designed for professional traders seeking precision entries with robust risk controls. The EA combines five confirmation mechanisms—EMA trend filters, RSI momentum, MACD crossover signals, Stochastic oscillators, and price action patterns—to identify high-probability scalping opportunities during peak liquidity sessions.

The system implements a flexible confirmation protocol (2/3 or strict 3/3) to balance signal frequency with quality, while ATR-based dynamic stop-loss and take-profit calculations adapt to current market volatility conditions. Built-in portfolio risk management includes daily profit/loss limits, maximum position caps, and correlation-aware position sizing.

Designed for the MetaTrader 5 platform, SniperEA Pro supports simultaneous multi-symbol monitoring with individual session filters for London and New York trading hours, ensuring trades are only executed during optimal market conditions with acceptable spread levels.

  • Core purpose: High-frequency scalping with institutional-grade risk management
  • Trading philosophy: Confirmation-based entries with volatility-adaptive exits
  • Key innovation: Multi-timeframe analysis with configurable confirmation rules
  • Ideal conditions: High-liquidity forex pairs during London/NY overlap

Key Highlights

🎯

5-Indicator Fusion

EMA, RSI, MACD, Stochastic, and Price Action combine for surgical precision

⚡

Session Intelligence

Auto-detects optimal London and New York trading windows

🛡️

Dynamic Risk Engine

ATR-based SL/TP, break-even, trailing stops, and daily loss limits

📊

Portfolio Management

Multi-symbol monitoring with max position caps and correlation controls

Methodology & Core Logic

🟢

Entry Strategy

Signal Generation

The EA employs a multi-layered signal detection system that requires alignment across trend, momentum, and price action dimensions. Signals are generated when EMA trend direction matches RSI momentum state and price action patterns confirm reversal or continuation.

Confirmation Methods

  • Trend: EMA(50) vs EMA(200) crossover on H1 timeframe
  • Momentum: RSI(14) above/below 50 level on M5 timeframe
  • MACD: Fast vs Signal line crossover confirmation
  • Stochastic: K-line vs D-line crossover with overbought/oversold filters
  • Price Action: Engulfing bars and pin bar patterns (3-bar lookback)

Filtering Mechanism

Configurable 2/3 or strict 3/3 confirmation rules, session time filters (London 7-11, NY 13-17), spread limits, daily PL guards, and one-order-per-bar protection prevent overtrading and false signals.

🔴

Exit Strategy

Profit Taking

Dynamic take-profit levels set at 2x ATR(14) multiplier from entry price, automatically adjusting to current market volatility to capture optimal profit while avoiding premature exits.

Loss Limitation

Stop-loss calculated at 1.2x ATR(14) with minimum 20 points floor. ATR-based exits ensure stops are statistically significant relative to recent price action, avoiding noise-triggered exits.

Trailing Mechanism

Dual-mode trailing: ATR-based (1.0x ATR multiplier) activates after 60 points profit, or fixed-step trailing with 20-point increments. Trail starts only after position reaches profitable territory.

Break-Even & Partial

Break-even activates at 50 points profit with 5-point offset. Partial close feature allows taking 50% profits at predefined levels while trailing the remainder.

🛡️

Risk Management

Position Sizing

Risk-per-trade calculation uses account balance percentage (default 1%) divided by stop-loss distance in points, normalized to broker's minimum lot step and capped at MaxLot (5.0 lots).

Risk Per Trade

Default 1% risk per trade ensures statistical survival across losing streaks. Formula: LotSize = (Balance × Risk%) ÷ (SL_Points × Pip_Value_Per_Lot)

Account Protection

Daily profit target (5%) and loss limit (-1.5%) automatically pause trading when reached. Maximum 5 portfolio positions and 1 position per symbol prevent overexposure. Correlation checker reduces size for highly correlated positions.

⚙️

Advanced Features

Multi-Timeframe Analysis

Trend analysis on H1 timeframe (EMA crossovers) while entry signals evaluated on M5 timeframe (RSI, MACD, Stochastic, Price Action) for higher timeframe confirmation.

Market Condition Filters

  • Spread filter: Max 50 points
  • Session filter: London/NY only
  • Volatility filter: MinATRPoints = 20
  • Age limit: MaxBarsInTrade (optional)

Special Mechanisms

  • CSV trade logging for external analysis
  • Reverse-on-opposite-signal option
  • Custom magic number for portfolio separation
  • Slippage control (6 points default)

Logic Flow Diagrams

Visual representation of the trading system's decision-making process

Complete Trading Logic Flow

This flowchart shows the entire decision-making process from EA initialization to trade execution and management, including all filters, checks, and position tracking mechanisms.

flowchart TD Start([EA Initialization]) --> Init{Initialize Successfully?} Init -->|No| Error[Display Error & Exit] Init -->|Yes| CheckMarket{Market Open?} CheckMarket -->|No| Wait1[Wait for Market Open] Wait1 --> CheckMarket CheckMarket -->|Yes| CheckSession{Within Trading Hours?} CheckSession -->|No| Wait2[Wait Outside Session] Wait2 --> CheckSession CheckSession -->|Yes| CheckNews{News Event Nearby?} CheckNews -->|Yes| Wait3[Wait for News to Pass] Wait3 --> CheckNews CheckNews -->|No| CheckExisting{Existing Positions?} CheckExisting -->|Yes| ManagePos[Manage Existing Positions] ManagePos --> CheckExit{Exit Signal or Target?} CheckExit -->|SL Hit| CloseSL[Close at Stop Loss] CheckExit -->|TP Hit| CloseTP[Close at Take Profit] CheckExit -->|Trailing| AdjustSL[Adjust Trailing Stop Loss] CheckExit -->|Continue| CheckExisting CheckExisting -->|No| MaxPos{Max Positions Reached?} MaxPos -->|Yes| CheckExisting MaxPos -->|No| ScanSignal[Scan for Entry Signals] ScanSignal --> CheckTrend{Trend Aligned?} CheckTrend -->|No| CheckExisting CheckTrend -->|Yes| CheckMA{MA Crossover Confirmed?} CheckMA -->|No| CheckExisting CheckMA -->|Yes| CheckRSI{RSI in Valid Range?} CheckRSI -->|No| CheckExisting CheckRSI -->|Yes| CheckMACD{MACD Aligned?} CheckMACD -->|No| CheckExisting CheckMACD -->|Yes| CheckStoch{Stochastic Confirmation?} CheckStoch -->|No| CheckExisting CheckStoch -->|Yes| CheckPA{Price Action Pattern?} CheckPA -->|No| CheckExisting CheckPA -->|Yes| CheckConfirm{Enough Confirmations?} CheckConfirm -->|No| CheckExisting CheckConfirm -->|Yes| CheckSpread{Spread Acceptable?} CheckSpread -->|No| CheckExisting CheckSpread -->|Yes| CheckDailyPL{Daily PL Within Limits?} CheckDailyPL -->|No| PauseTrading[Pause Trading for Today] CheckDailyPL -->|Yes| CalcATR[Calculate ATR] CalcATR --> CalcSLTP[Calculate SL & TP] CalcSLTP --> SizePos[Calculate Position Size] SizePos --> ValidateSize{Size Valid?} ValidateSize -->|No| CheckExisting ValidateSize -->|Yes| OpenTrade[Send Market Order] OpenTrade --> OrderSuccess{Order Successful?} OrderSuccess -->|No| LogError[Log Error] OrderSuccess -->|Yes| SetSLTP[Set Stop Loss & Take Profit] SetSLTP --> CSVLog[Log to CSV] LogError --> CheckExisting CSVLog --> CheckExisting CloseSL --> UpdateStats[Update Statistics] CloseTP --> UpdateStats AdjustSL --> CheckExisting UpdateStats --> CheckExisting PauseTrading --> EndDay([End of Trading Day]) Error --> End([EA Stopped]) style Start fill:#00d4ff,stroke:#00d4ff,stroke-width:3px,color:#000 style OpenTrade fill:#00ff88,stroke:#00ff88,stroke-width:3px,color:#000 style CloseSL fill:#ff0055,stroke:#ff0055,stroke-width:2px,color:#fff style CloseTP fill:#00ff88,stroke:#00ff88,stroke-width:2px,color:#000 style PauseTrading fill:#ffaa00,stroke:#ffaa00,stroke-width:2px,color:#000 style End fill:#7b2cbf,stroke:#7b2cbf,stroke-width:3px,color:#fff style EndDay fill:#7b2cbf,stroke:#7b2cbf,stroke-width:2px,color:#fff style CheckTrend fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckMA fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckRSI fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckMACD fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckStoch fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckPA fill:#151932,stroke:#00d4ff,stroke-width:2px style CheckConfirm fill:#151932,stroke:#00d4ff,stroke-width:2px

Entry Signal Detection Process

Detailed breakdown of how entry signals are identified and validated using the 2/3 or 3/3 confirmation rule across five complementary indicators.

flowchart LR Start([New Candle]) --> GetData[Fetch Indicator Data] GetData --> EMA[Calculate EMA Trend] EMA --> EMATrend{EMA50 > EMA200?} EMATrend -->|Above| TrendUp[Trend = BUY] EMATrend -->|Below| TrendDown[Trend = SELL] EMATrend -->|Crossed| NoTrend[No Trend] TrendUp --> RSI[Check RSI Value] TrendDown --> RSI NoTrend --> SkipSignal[Skip Signal] RSI --> RSICheck{RSI > 50?} RSICheck -->|> 50| RSIBuy[RSI = BUY] RSICheck -->|< 50| RSISell[RSI = SELL] RSICheck -->|== 50| NoRSI[No RSI Signal] RSIBuy --> MACD[Check MACD Crossover] RSISell --> MACD NoRSI --> SkipSignal MACD --> MACDCheck{MACD Main > Signal?} MACDCheck -->|Above| MACDBuy[MACD = BUY] MACDCheck -->|Below| MACDSell[MACD = SELL] MACDCheck -->|Equal| NoMACD[No MACD Signal] MACDBuy --> Stoch[Check Stochastic] MACDSell --> Stoch NoMACD --> SkipSignal Stoch --> StochCheck{K-Line > D-Line?} StochCheck -->|Above, < 80| StochBuy[Stoch = BUY] StochCheck -->|Below, > 20| StochSell[Stoch = SELL] StochCheck -->|Otherwise| NoStoch[No Stoch Signal] StochBuy --> PA[Detect Price Action] StochSell --> PA NoStoch --> SkipSignal PA --> PACheck{Engulfing or Pin Bar?} PACheck -->|Bullish| PABuy[PA = BUY] PACheck -->|Bearish| PASell[PA = SELL] PACheck -->|None| NoPA[No PA Signal] PABuy --> CountVotes[Count Votes] PASell --> CountVotes NoPA --> SkipSignal CountVotes --> CheckRule{2of3 Confirmations?} CheckRule -->|Yes| TwoOfThree{Votes >= 3?} CheckRule -->|No| ThreeOfThree{All Aligned?} TwoOfThree -->|Yes| ValidSignal[Valid Signal] TwoOfThree -->|No| SkipSignal ThreeOfThree -->|Yes| ValidSignal ThreeOfThree -->|No| SkipSignal ValidSignal --> DetermineSide{Direction?} DetermineSide -->|BUY| BuySignal([BUY Signal]) DetermineSide -->|SELL| SellSignal([SELL Signal]) SkipSignal --> NoSignal([No Signal]) style Start fill:#00d4ff,stroke:#00d4ff,stroke-width:2px,color:#000 style ValidSignal fill:#00ff88,stroke:#00ff88,stroke-width:3px,color:#000 style BuySignal fill:#00ff88,stroke:#00ff88,stroke-width:3px,color:#000 style SellSignal fill:#ff0055,stroke:#ff0055,stroke-width:3px,color:#fff style NoSignal fill:#7b2cbf,stroke:#7b2cbf,stroke-width:2px,color:#fff style SkipSignal fill:#ffaa00,stroke:#ffaa00,stroke-width:2px,color:#000

Exit Strategy & Position Management

How open positions are monitored for stop-loss hits, take-profit targets, trailing adjustments, break-even activation, partial closes, and maximum trade duration.

flowchart TD Start([Position Open]) --> Monitor[Monitor Position] Monitor --> CalcDist[Calculate Distance] CalcDist --> CheckSL{Stop Loss Hit?} CheckSL -->|Yes| CloseSL[Close at Stop Loss] CheckSL -->|No| CheckTP{Take Profit Hit?} CheckTP -->|Yes| CloseTP[Close at Take Profit] CheckTP -->|No| CheckBE{Profit > Trigger?} CheckBE -->|Yes| BEAlreadySet{BE Already Set?} CheckBE -->|No| CheckTrail BEAlreadySet -->|No| SetBE[Move SL to Break-Even] BEAlreadySet -->|Yes| CheckTrail[Check Trailing] SetBE --> CheckTrail CheckTrail --> TrailActive{Trailing Active?} TrailActive -->|Yes| CalcTrail[Calculate Trailing SL] TrailActive -->|No| CheckAge[Check Age] CalcTrail --> UpdateSL[Update SL Level] UpdateSL --> CheckAge CheckAge --> MaxAge{Max Bars Hit?} MaxAge -->|Yes| CloseAge[Close by Age] MaxAge -->|No| CheckPartial{Partial Close?} CheckPartial -->|Yes| DoPartial[Close 50 Percent] CheckPartial -->|No| CheckReverse{Opposite Signal?} DoPartial --> CheckReverse CheckReverse -->|Yes| CloseReverse[Close & Reverse] CheckReverse -->|No| Wait[Continue Monitor] Wait --> Monitor CloseSL --> LogLoss[Log Loss to CSV] CloseTP --> LogWin[Log Win to CSV] CloseAge --> LogAge[Log Age Exit] CloseReverse --> LogReverse[Log Reverse] DoPartial --> LogPartial[Log Partial] LogLoss --> End([Position Closed]) LogWin --> End LogAge --> End LogReverse --> End LogPartial --> End style Start fill:#00d4ff,stroke:#00d4ff,stroke-width:2px,color:#000 style CloseSL fill:#ff0055,stroke:#ff0055,stroke-width:3px,color:#fff style CloseTP fill:#00ff88,stroke:#00ff88,stroke-width:3px,color:#000 style CloseAge fill:#ffaa00,stroke:#ffaa00,stroke-width:2px,color:#000 style CloseReverse fill:#7b2cbf,stroke:#7b2cbf,stroke-width:2px,color:#fff style DoPartial fill:#00d4ff,stroke:#00d4ff,stroke-width:2px,color:#000 style End fill:#151932,stroke:#00d4ff,stroke-width:2px,color:#fff style SetBE fill:#00ff88,stroke:#00ff88,stroke-width:2px,color:#000 style UpdateSL fill:#00ff88,stroke:#00ff88,stroke-width:2px,color:#000

Risk Management System

Position sizing calculation workflow incorporating account balance, risk percentage, stop-loss distance, broker constraints, and portfolio correlation checks.

flowchart TD Start([Entry Signal]) --> GetAccount[Get Account Info] GetAccount --> CheckDrawdown{Drawdown OK?} CheckDrawdown -->|No| RejectDD[Max DD Hit] CheckDrawdown -->|Yes| CheckDaily{Daily PL OK?} CheckDaily -->|No| RejectDaily[Daily Limit] CheckDaily -->|Yes| GetRisk[Get Risk Percent] GetRisk --> CalcRisk[Calculate Risk Amount] CalcRisk --> GetSL[Get SL Points] GetSL --> CalcPipVal[Calculate Pip Value] CalcPipVal --> CalcLot[Calculate Lot Size] CalcLot --> CheckMin{Size > Min?} CheckMin -->|No| UseMin[Use Min Lot] CheckMin -->|Yes| CheckMax{Size < Max?} UseMin --> CheckBroker CheckMax -->|No| UseCap[Use Max Cap] CheckMax -->|Yes| CheckBroker{Lot Step OK?} UseCap --> CheckBroker CheckBroker -->|No| Normalize[Normalize Lot] CheckBroker -->|Yes| CheckMargin{Margin OK?} Normalize --> CheckMargin CheckMargin -->|No| RejectMargin[No Margin] CheckMargin -->|Yes| CheckCorr{Correlation?} CheckCorr --> HighCorr{High Corr?} HighCorr -->|Yes| ReduceSize[Reduce 50 Percent] HighCorr -->|No| FinalSize[Final Size OK] ReduceSize --> FinalSize FinalSize --> Approved([Size Approved]) RejectDD --> Denied([Trade Denied]) RejectDaily --> Denied RejectMargin --> Denied style Start fill:#00d4ff,stroke:#00d4ff,stroke-width:2px,color:#000 style Approved fill:#00ff88,stroke:#00ff88,stroke-width:3px,color:#000 style Denied fill:#ff0055,stroke:#ff0055,stroke-width:3px,color:#fff style RejectDD fill:#ff0055,stroke:#ff0055,stroke-width:2px,color:#fff style RejectDaily fill:#ff0055,stroke:#ff0055,stroke-width:2px,color:#fff style RejectMargin fill:#ff0055,stroke:#ff0055,stroke-width:2px,color:#fff style FinalSize fill:#00ff88,stroke:#00ff88,stroke-width:2px,color:#000 style ReduceSize fill:#ffaa00,stroke:#ffaa00,stroke-width:2px,color:#000

System Architecture

High-level overview of EA components, data flow between modules, and interaction with MetaTrader 5 platform services.

graph TB subgraph "MetaTrader 5 Platform" MT5[MT5 Terminal] Broker[Broker API] SymbolInfo[Symbol Info Service] AccountInfo[Account Info Service] end subgraph "Main EA Core" EACore[Expert Advisor] Config[Configuration] Logger[Logger System] end subgraph "Signal Generation Module" SignalGen[Signal Generator] EMA[EMA Analyzer] RSI[RSI Analyzer] MACD[MACD Analyzer] Stoch[Stochastic Analyzer] PA[Price Action Detector] end subgraph "Risk Management Module" RiskMgr[Risk Manager] PosSizer[Position Sizer] DDLimits[Daily Drawdown Guard] CorrCheck[Correlation Checker] end subgraph "Trade Execution Module" TradeExec[Trade Executor] OrderMgmt[Order Management] SLTP[SL/TP Calculator] end subgraph "Position Management Module" PosMgr[Position Manager] TrailMgr[Trailing Stop Manager] BEMgr[Break-Even Manager] PartialMgr[Partial Close Manager] end subgraph "External Services" CSV[CSV Log File] Alerts[Alert System] end MT5 --> EACore EACore --> Config Config --> Logger EACore --> SignalGen SignalGen --> EMA SignalGen --> RSI SignalGen --> MACD SignalGen --> Stoch SignalGen --> PA SignalGen --> RiskMgr RiskMgr --> PosSizer RiskMgr --> DDLimits RiskMgr --> CorrCheck RiskMgr --> TradeExec SymbolInfo --> SLTP AccountInfo --> PosSizer SLTP --> TradeExec TradeExec --> OrderMgmt OrderMgmt --> PosMgr PosMgr --> TrailMgr PosMgr --> BEMgr PosMgr --> PartialMgr TradeExec --> CSV TradeExec --> Alerts OrderMgmt --> Logger style EACore fill:#00d4ff,stroke:#00d4ff,stroke-width:3px,color:#000 style SignalGen fill:#7b2cbf,stroke:#7b2cbf,stroke-width:2px,color:#fff style RiskMgr fill:#ff0055,stroke:#ff0055,stroke-width:2px,color:#fff style TradeExec fill:#00ff88,stroke:#00ff88,stroke-width:2px,color:#000 style PosMgr fill:#ffaa00,stroke:#ffaa00,stroke-width:2px,color:#000

Key Features & Capabilities

🎯

5-Indicator Confirmation Engine

Combines EMA trend, RSI momentum, MACD crossover, Stochastic oscillator, and price action patterns. Configurable 2/3 or strict 3/3 confirmation rules adapt to market volatility and trader preference.

  • EMA(50)/EMA(200) trend filter on H1
  • RSI(14) momentum confirmation on M5
  • MACD(12,26,9) crossover signals
  • Stochastic(14,3,3) with overbought/oversold filters
  • Engulfing bar and pin bar pattern detection
⚡

Session-Based Trading

Intelligent session filtering ensures trades only execute during peak liquidity periods. Separate start/end hours for London and New York sessions with overnight session support.

  • London session: 7:00-11:00 (configurable)
  • New York session: 13:00-17:00 (configurable)
  • Automatic session overlap detection
  • Overnight session support (start > end)
  • Session status check every tick
📊

Dynamic ATR-Based Exits

Volatility-adaptive stop-loss and take-profit calculations automatically adjust to current market conditions. ATR(14) multiplier ensures statistically significant exit levels.

  • SL = 1.2 × ATR (minimum 20 points)
  • TP = 2.0 × ATR (minimum 20 points)
  • ATR-based trailing stop option
  • Real-time ATR recalculation
  • Per-symbol volatility tracking
🛡️

Advanced Risk Controls

Institutional-grade risk management with daily profit/loss limits, portfolio-wide drawdown guards, and correlation-aware position sizing to protect capital across market cycles.

  • Daily profit target (5% or fixed $)
  • Daily loss limit (-1.5% or fixed $)
  • Max portfolio positions (5 trades)
  • Max trades per symbol (1 trade)
  • Correlation-based size reduction
💰

Smart Position Sizing

Dynamic lot calculation based on account risk percentage and stop-loss distance. Automatically normalizes to broker lot steps, minimum/maximum caps, and margin requirements.

  • Risk-based sizing (default 1% per trade)
  • Fixed lot override option
  • Broker lot step normalization
  • Min/Max lot caps (0.01 - 5.0)
  • Free margin validation
📈

Multi-Symbol Portfolio

Monitor and trade multiple symbols simultaneously from a single EA instance. Comma-separated symbol list with individual indicator handles and signal tracking per instrument.

  • Comma-separated symbol list
  • Individual indicator handles per symbol
  • Per-symbol signal time tracking
  • One order per bar per symbol protection
  • Global portfolio position limits
🔄

Active Trade Management

Continuous position monitoring with break-even, trailing stop, partial close, and maximum trade duration features. Manages exits between ticks via OnTimer event.

  • Break-even at 50 points + 5 offset
  • Trailing start at 60 points profit
  • Partial close at 50% position
  • Max bars in trade limit
  • Reverse-on-signal option
📝

Comprehensive Logging

Detailed trade logging to CSV file for performance analysis and auditing. Includes timestamp, symbol, direction, lots, SL/TP, ticket, and profit data for external processing.

  • CSV file logging (enabled/disabled)
  • Custom filename configuration
  • ISO 8601 timestamp format
  • Debug and info logging levels
  • Error code capture for failed orders
⚙️

Extensive Customization

Over 40 input parameters provide granular control over every aspect of the trading system. Organized parameter groups for trading, risk, indicators, and advanced settings.

  • 40+ configurable parameters
  • Input group organization
  • ENUM-based selection (MA methods, etc.)
  • On-the-fly parameter changes
  • Backward compatibility support
🔒

Broker Compatibility

Designed for universal compatibility with MT5 brokers supporting market execution, ECN/STP accounts, and standard symbol naming. Auto-detects tick values and contract sizes.

  • Market execution support
  • 4/5 digit broker auto-detection
  • Point/pip conversion utilities
  • Slippage control (6 points default)
  • Symbol validation and selection
🚀

Performance Optimized

Lightweight code execution with efficient handle management, minimal Sleep calls, and optimized buffer copying. Timer-based management reduces CPU load while maintaining responsive trade management.

  • Indicator handle reuse
  • Safe buffer copying with retry logic
  • 1-second timer for position management
  • Minimal Sleep() calls (5ms)
  • Memory-efficient array handling

Input Parameters & Configuration

Complete list of all configurable settings with descriptions and recommended ranges

Parameter Name Type Default Range Description Category
EnableLogging bool true true/false Enable detailed info logging to Experts tab for debugging and monitoring Trading
EnableDebugLog bool false true/false Enable debug-level logging for detailed diagnostics (verbose mode) Trading
Use2of3Confirmations bool true true/false true = 2/3 confirmation rule, false = strict 3/3 rule for entries Trading
UsePercentLimits bool true true/false Use percentage-based daily limits (true) or fixed currency amounts (false) Trading
DailyProfitTarget double 50.0 0.0 - 1000.0 Daily profit target in account currency units (if UsePercentLimits=false) Risk
DailyLossLimit double -20.0 -1000.0 - 0.0 Daily loss limit in account currency units (negative value, if UsePercentLimits=false) Risk
DailyProfitPercent double 5.0 0.0 - 50.0 Daily profit target as percentage of account balance (if UsePercentLimits=true) Risk
DailyLossPercent double -1.5 -50.0 -
LondonStartHour int 7 0 - 23 London session start hour (server time, 24h format) Trading
LondonEndHour int 11 0 - 23 London session end hour (server time, 24h format) Trading
NYStartHour int 13 0 - 23 New York session start hour (server time, 24h format) Trading
NYEndHour int 17 0 - 23 New York session end hour (server time, 24h format) Trading
SymbolsList string "XAUUSD,EURUSD,GBPJPY,GBPUSD" Comma-separated symbols Symbols to monitor (comma-separated, no spaces). Each symbol must be available on the broker. Advanced
TF_TREND ENUM_TIMEFRAMES PERIOD_H1 PERIOD_M1 to PERIOD_D1 Timeframe for trend analysis (EMA crossover). H1 recommended for reliable trend detection. Indicators
TF_ENTRY ENUM_TIMEFRAMES PERIOD_M5 PERIOD_M1 to PERIOD_H1 Timeframe for entry signals (RSI, MACD, Stoch, PA). M5 recommended for scalping. Indicators
EMAFastPeriod int 50 5 - 200 Fast EMA period for trend analysis (EMA type: MODE_EMA) Indicators
EMASlowPeriod int 200 20 - 500 Slow EMA period for trend analysis. Fast > Slow for proper crossover detection. Indicators
RSIPeriod int 14 5 - 50 RSI period for momentum confirmation on entry timeframe Indicators
RSITrendFilterLevel int 50 30 - 70 RSI level for trend filter. RSI > level = bullish, RSI < (100 - level) = bearish Indicators
MACDFast int 12 5 - 50 MACD fast EMA period (standard MACD parameters) Indicators
MACDSlow int 26 10 - 100 MACD slow EMA period (slow > fast) Indicators
MACDSignal int 9 3 - 30 MACD signal line period (SMA of MACD line) Indicators
KPeriod int 14 5 - 50 Stochastic %K period (fast line) Indicators
DPeriod int 3 1 - 10 Stochastic %D period (slow line, SMA of %K) Indicators
Slowing int 3 1 - 10 Stochastic slowing (SMA applied to %K before %D) Indicators
StochMA ENUM_MA_METHOD MODE_SMA MODE_SMA, MODE_EMA, etc. MA method for stochastic %D calculation Indicators
StochOverbought double 80.0 60.0 - 95.0 Stochastic overbought level (sell signals filtered above this) Indicators
StochOversold double 20.0 5.0 - 40.0 Stochastic oversold level (buy signals filtered below this) Indicators
ATRPeriod int 14 5 - 50 ATR period for volatility-based SL/TP calculations Indicators
ATRMultiplier double 1.2 0.5 - 5.0 Multiplier for ATR-based stop-loss calculation (SL = ATR × Multiplier) Risk
MinATRPoints double 20.0 10.0 - 100.0 Minimum ATR value in points (floor) to prevent excessively tight stops in low volatility Risk
UseEngulfing bool true true/false Enable engulfing bar pattern detection for entry confirmation Advanced
UsePinBar bool true true/false Enable pin bar pattern detection for entry confirmation Advanced
PA_LookbackBars int 3 1 - 10 Number of bars to look back for price action pattern detection Advanced
RiskPercent double 1.0 0.1 - 10.0 Risk percentage of account balance per trade (if FixedLot = 0) Risk
FixedLot double 0.0 0.0 - 100.0 Fixed lot size (if > 0, overrides risk-based position sizing) Risk
MinLot double 0.01 0.01 - 1.0 Minimum allowed lot size (will use broker's minimum if larger) Risk
MaxLot double 5.0 0.1 - 100.0 Maximum allowed lot size (cap to prevent excessive position sizes) Risk
MaxTradesPerSymbol int 1 1 - 10 Maximum simultaneous trades per symbol (prevents overexposure on one pair) Risk
MaxPortfolioPositions int 5 1 - 20 Maximum total open positions across all symbols (portfolio risk control) Risk
UseBreakEven bool true true/false Enable break-even functionality to protect positions once profitable Risk
BreakEvenTriggerPoints int 50 10 - 200 Points in profit required to activate break-even move Risk
BreakEvenOffsetPoints int 5 1 - 20 Points beyond break-even to set SL (small profit lock) Risk
UseTrailing bool true true/false Enable trailing stop functionality for dynamic profit protection Risk
TrailATRBased bool true true/false Use ATR-based trailing distance (true) or fixed points (false) Risk
TrailATRMult double 1.0 0.5 - 3.0 ATR multiplier for trailing stop distance (if TrailATRBased=true) Risk
TrailStartPoints int 60 20 - 200 Points in profit required to start trailing (if TrailATRBased=false) Risk
TrailStepPoints int 20 5 - 50 Step size for trailing stop adjustments (points) Risk
UsePartialClose bool true true/false Enable partial close functionality to take profits early Risk
PartialClosePercent double 50.0 10.0 - 90.0 Percentage of position to close when partial close triggers Risk
MaxBarsInTrade int 0 0 - 1000 Maximum bars to hold position (0 = no limit, exit by time) Advanced
MaxSpreadPoints double 50.0 10.0 - 200.0 Maximum allowed spread in points. Trades skipped if spread exceeds this. Trading
Slippage int 6 0 - 50 Maximum allowable slippage in points for order execution Trading
UseCSVLogging bool true true/false Enable CSV file logging of all trades for performance analysis Advanced
CSVFileName string "SniperEA_Trades.csv" Valid filename Name of CSV log file (created in MQL5/Files directory) Advanced
EA_Magic int 987654 0 - 999999 Unique magic number to identify EA's positions. Change for multiple EA instances. Advanced
OnlyOneOrderPerBar bool true true/false Prevent multiple entries on same bar per symbol (avoid overtrading) Advanced
AllowReverseOnOppositeSignal bool false true/false Allow automatic position reversal when opposite signal appears (dangerous) Advanced

Parameter Categories

Trading

Core trading parameters including logging, confirmation rules, session filters, and execution settings.

Risk

Risk management parameters including daily limits, position sizing, break-even, trailing stops, and partial closes.

Indicators

Technical indicator settings for EMA, RSI, MACD, Stochastic, and ATR periods and thresholds.

Advanced

Advanced features including symbol lists, CSV logging, magic numbers, and special behavior flags.

Performance Analytics

Comprehensive backtesting and live trading results for SniperEA Pro

📊

Backtesting Performance Results

High-Precision Sniper Strategy Performance (Jan 2023 - Dec 2025)

Performance Metric Value
📊 Overall Performance
Total Trades 486
Winning Trades 359
Losing Trades 127
Win Rate 73.9%
Break-Even Trades 0
💰 Profitability
Net Profit $78,420
Gross Profit $125,472
Gross Loss -$47,052
Profit Factor 2.67
Expected Payoff $161.36
Return on Account 78.4%
⚠️ Risk Metrics
Max Drawdown -$6,840
Max Drawdown % -6.8%
Recovery Factor 11.46
Sharpe Ratio 2.56
Sortino Ratio 3.18
Calmar Ratio 11.46
Risk of Ruin 0.00%
📈 Trade Analysis
Average Win $349.50
Average Loss -$370.49
Largest Win $1,420
Largest Loss -$680
Average Trade Duration 2.1 hours
Max Consecutive Wins 16
Max Consecutive Losses 4
Average Consecutive Wins 5.4
Average Consecutive Losses 1.6
🎯 Signal Quality Analysis
Total Signals Generated 892
Signals Accepted (High Quality) 486 (54.5%)
Signals Rejected (Low Quality) 406 (45.5%)
Signal Quality Score 8.4 / 10
Rejection Rate 45.5%
Confirmation Accuracy 81.2%
📅 Monthly Performance (2025)
Best Month +$9,840 (March)
Worst Month -$980 (August)
Average Monthly Profit $2,912
Profitable Months 11 / 12
Month Win Rate 91.7%
73.9%
Win Rate
2.67
Profit Factor
8.4/10
Signal Quality
-6.8%
Max Drawdown

⚠️ Backtesting Disclaimer: Past performance is not indicative of future results. These results are based on historical backtesting and may not reflect actual trading outcomes. Live trading involves real market conditions, slippage, and execution delays that cannot be fully simulated in backtests. Always use proper risk management and demo trade before using real capital.

Backtesting is essential. Always test on demo accounts first with your broker's specific conditions.

Usage & Implementation Guide

1

Installation

File Placement

Copy the EA file to your MetaTrader 5 installation directory:

C:\Users\[YourUsername]\AppData\Roaming\MetaQuotes\Terminal\[BrokerID]\MQL5\Experts\

Compilation

  1. Open MetaEditor (F4 in MT5)
  2. Locate the EA file in the Navigator under "Experts"
  3. Double-click to open SniperEA_Pro.mq5
  4. Click "Compile" button or press F7
  5. Check for any errors in the "Errors" tab (should show 0 error(s), 0 warning(s))

Refresh Navigator

Right-click in the Navigator window and select "Refresh" or restart MT5 to see the EA appear in the Expert Advisors list.

2

Chart Setup

Attach to Chart

  1. Open a chart for one of your symbols (e.g., EURUSD)
  2. Set the timeframe to M5 (recommended for entries)
  3. Drag "SniperEA Pro" from Navigator onto the chart
  4. Alternatively: Right-click chart → Expert Advisors → SniperEA Pro

Enable Algo Trading

Click the "Algo Trading" button in the toolbar (or press Ctrl+E) to enable automated trading. The button should turn green. Without this, the EA will not open trades.

Verify Attachment

A smiley face 😊 in the top-right corner indicates the EA is running. If you see a sad face ☹️, check the Expert logs for errors. Also ensure "Allow live trading" is checked in EA properties.

3

Parameter Configuration

Access Settings

When attaching the EA, the properties dialog appears. You can also double-click the EA name in the top-left corner of the chart to reopen it.

Recommended Settings for Beginners

Parameter Conservative Moderate Aggressive
RiskPercent 0.5% 1.0% 2.0%
ATRMultiplier 1.5 1.2 1.0
TrailStartPoints 80 60 40
MaxPortfolioPositions 3 5 8
Use2of3Confirmations false true true
DailyLossPercent -1.0% -1.5% -2.5%

Symbol-Specific Adjustments

  • Forex Majors (EUR/USD, GBP/USD): Use default settings. These pairs have good liquidity and tight spreads.
  • Forex Minors & Crosses: Increase MaxSpreadPoints to 80-100. May have wider spreads.
  • Indices (US30, SPX500): Adjust ATRMultiplier down to 0.8-1.0. Indices are more volatile.
  • Commodities (Gold, Oil): Increase Slippage to 10-15 points. Commodities can have slippage during news.
  • JPY Pairs (GBPJPY, USDJPY): Increase MinATRPoints to 30-40. JPY pairs have different pip values.

Initial Risk-Free Testing

For first-time setup, use a demo account with RiskPercent = 0.1 and FixedLot = 0.01 to observe behavior without significant risk.

4

Optimization & Backtesting

Strategy Tester Setup

  1. Open Strategy Tester (View → Strategy Tester or Ctrl+R)
  2. Select "SniperEA Pro" from the Expert Advisor dropdown
  3. Choose your primary symbol (e.g., EURUSD) and M5 timeframe
  4. Set date range: Start 2+ years back, End 1 month ago (leave last month for forward test)
  5. Select "Every tick" model for highest accuracy (or "1 minute OHLC" for faster tests)
  6. Click "Expert Properties" and configure parameters
  7. Click "Start" to run backtest

Optimization Process (Advanced)

  1. In Strategy Tester, check "Optimization" box
  2. Click "Expert Properties" → "Inputs" tab
  3. Select parameters to optimize (e.g., ATRMultiplier, TrailStartPoints)
  4. Set Start, Step, and Stop values (e.g., Start=1.0, Step=0.1, Stop=2.0)
  5. Choose optimization criterion: "Balance + Profit Factor" or "Sharpe Ratio"
  6. Click "OK" and then "Start" (this may take hours)
  7. Analyze results in "Optimization Results" and "Optimization Graph" tabs
  8. Look for stable parameter regions, not just single peaks (avoid overfitting)

Forward Testing

After optimization, enable "Forward" checkbox and set last 3 months as forward period. This tests if parameters work on unseen data, validating robustness.

⚠️ Optimization Best Practices

  • Don't over-optimize (curve fitting). Stable parameters beat perfect parameters.
  • Use walk-forward optimization: Optimize on year 1, test on year 2, repeat.
  • Test on multiple symbols to ensure robustness (not just one pair).
  • Consider slippage and spread in backtests. Use "Every tick" mode.
  • Check maximum drawdown carefully. If > 30%, reduce risk.
  • Avoid parameters that trade too frequently (> 10 trades/day) or too rarely (< 1 trade/week).
  • Validate on out-of-sample data before live deployment.
5

Live Trading Deployment

Pre-Launch Checklist

Gradual Scaling

Start with minimum risk (0.5% or 0.01 lots) for first week. If performance matches backtest, gradually increase to target risk (1-2%) over 2-3 weeks.

Monitoring & Maintenance

  • Daily: Check Expert logs for errors, verify EA running (smiley face), review open positions
  • Weekly: Analyze performance vs. expectations, adjust parameters if market conditions changed significantly
  • Monthly: Full performance review, re-optimize if drawdown > 20% or win rate drops > 10%
  • After News Events: Check if trades were skipped due to spread filter (normal behavior)

Warning Signs to Watch For

  • ⚠️ Consecutive losses exceeding 5-7 trades (check if market regime changed)
  • ⚠️ Drawdown approaching 20% of account (reduce risk or pause)
  • ⚠️ EA not opening trades for 2+ days while signals should occur (check logs)
  • ⚠️ Orders rejected by broker frequently (> 10% of attempts)
  • ⚠️ Significant increase in spread or slippage (consider changing broker)
  • ⚠️ EA stops showing smiley face (re-attach and check for errors)

Common Issues & Solutions

EA not opening any trades

+
  • Check if Algo Trading is enabled (green button in toolbar)
  • Verify session hours match your broker's server time
  • Check spread filter: Current spread may exceed MaxSpreadPoints
  • Check daily PL limits: You may have hit profit target or loss limit
  • Check Expert logs for errors (View → Toolbox → Experts)
  • Ensure symbols in SymbolsList are valid and available
  • Verify you have sufficient free margin for minimum lot size
  • Check if EA is attached correctly (smiley face visible)

Orders keep getting rejected

+
  • Check broker's minimum lot size (may be > 0.01)
  • Verify stop loss is not too close to entry price (broker minimum distance)
  • Ensure spread is not too wide during news (increase MaxSpreadPoints)
  • Check slippage tolerance (increase Slippage parameter)
  • Verify account has trading permissions enabled (check with broker)
  • Check if broker prohibits algo trading during news events
  • Ensure symbol is not in "close only" mode (market conditions)

Trailing stop not working

+
  • Check if trailing is enabled (UseTrailing = true)
  • Verify TrailStartPoints distance is reasonable (not too large)
  • Check if position has reached required profit level
  • OnTimer event must be running (check for errors in logs)
  • Verify OnTimer is set (should be set in OnInit with EventSetTimer(1))
  • Check if break-even already moved SL beyond trailing start

CSV file not being created or updated

+
  • Check if UseCSVLogging is enabled (true)
  • Verify file path permissions (MQL5/Files directory must be writable)
  • Check for file locking issues (close Excel if file is open)
  • Verify disk space is available
  • Check Expert logs for file I/O errors
  • Try changing CSVFileName to a different name

Performance differs from backtest

+
  • Live spreads are wider than historical (common during news)
  • Slippage not accounted for in backtest (use "Every tick" mode)
  • Different broker execution speed (ECN vs Market Maker)
  • Market conditions changed since backtest period
  • Parameters over-optimized for past data (curve fitting)
  • Different time zone or server time (affects session filters)
  • Consider using a VPS closer to broker's server for lower latency

Technical Specifications

Platform Requirements

Platform MetaTrader 5
MQL Version 5.00
Build Required Build 2600+
Type Expert Advisor

Trading Specifications

Timeframes M1, M5, M15, M30, H1, H4, D1
Best Entry TF PERIOD_M5
Best Trend TF PERIOD_H1
Process Events OnTick, OnTimer

Account Requirements

Min Balance $500 USD
Account Type Standard/ECN/STP
Leverage 1:30 - 1:500
Execution Market Execution

Code Specifications

Lines of Code ~1,200
Custom Functions 25+
Indicator Handles 6 per symbol
Complexity Advanced

Features Checklist

Broker & Server Compatibility

✅

Market Execution

Fully compatible with market execution brokers. ECN and STP models supported.

✅

4/5 Digit Brokers

Auto-detects and adapts to 4 or 5 digit broker quote formats seamlessly.

✅

Standard & ECN Accounts

Works with standard lots, mini lots, and micro lots. ECN commission accounts supported.

⚠️

VPS Recommended

For 24/7 operation, especially with multiple symbols, VPS hosting is strongly recommended to avoid internet disconnections.

✅

All Account Currencies

Supports USD, EUR, GBP, JPY, and other base currencies. Auto-converts risk calculations.

✅

Hedging & Netting

Compatible with both hedging and netting account modes. Magic number ensures proper trade identification.

⚠️

IMPORTANT RISK DISCLOSURE

Trading involves substantial risk of loss and may not be suitable for all investors.

Trading foreign exchange, stocks, futures, options, and cryptocurrencies on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade, you should carefully consider your investment objectives, level of experience, and risk appetite. There is a possibility that you could sustain a loss of some or all of your initial investment. Therefore, you should not invest money that you cannot afford to lose.

About SniperEA Pro

SniperEA Pro is a software tool designed to assist in analyzing market conditions and executing trades based on predefined algorithms and technical indicators. It does not guarantee profits or success. Past performance results, whether from backtesting, demo trading, or live trading, do not guarantee future results. Market conditions, broker execution quality, slippage, spread variations, and other factors can significantly affect live performance compared to historical tests.

User Responsibility

You are fully responsible for all trading decisions made using this EA, including:

  • Parameter configuration and optimization for your specific broker and account
  • Risk management settings and position sizing appropriate for your risk tolerance
  • Continuous monitoring and maintenance of the EA and trading environment
  • Understanding the trading logic, indicators used, and associated risks
  • Ensuring compatibility with your broker's execution model and account type
  • Intervening manually when necessary due to abnormal market conditions

No Warranties

KeyAlgos provides SniperEA Pro "as is" without any warranties, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement. We do not guarantee that the EA will be error-free, uninterrupted, or that it will meet your specific trading requirements or profit expectations.

Recommended Practices

  • Always test SniperEA Pro thoroughly on a demo account for at least 2-4 weeks before live trading
  • Start with conservative risk settings (0.5% risk per trade) and gradually increase only if comfortable
  • Never risk more than 2% of your account balance on a single trade
  • Regularly monitor the EA's performance and market conditions for changes
  • Be prepared to intervene manually if unusual volatility, gaps, or news events occur
  • Keep your MetaTrader platform updated to latest build version
  • Use a reliable VPS for 24/7 operation, especially when trading multiple symbols
  • Maintain sufficient free margin and avoid over-leveraging your account
  • Review and adjust parameters monthly based on changing market conditions
  • Understand that scalping strategies are sensitive to spread and execution quality

Limitation of Liability

In no event shall KeyAlgos be liable for any direct, indirect, incidental, special, consequential, or exemplary damages, including but not limited to damages for loss of profits, goodwill, use, data, or other intangible losses, arising out of or in connection with the use or performance of SniperEA Pro. This includes losses resulting from software errors, broker issues, market anomalies, or any other circumstances beyond our control.