Files
MT5-EA-Sniper-Strategy/docs/TESTING_GUIDE.md
T
rithsila 2a998b1e2a feat: Complete Phase 1 implementation and comprehensive development workflow
 Phase 1 Core Trading Logic - COMPLETE (100%)
- All core trading functions implemented and tested
- Pattern detection working (OB, FVG, BOS, Liquidity Sweeps)
- Risk management system functional (1% risk per trade)
- Multi-timeframe analysis operational
- Trade execution logic complete
- Strategy Tester validation successful

📚 Development Workflow Framework - NEW
- Complete MT5 EA development workflow documentation
- 4-tier testing protocol (Unit → Integration → Strategy → Live Demo)
- Compilation automation and validation scripts
- Feature branch methodology for incremental development
- Performance regression testing framework
- Standardized test datasets for consistent backtesting

🧪 Testing Infrastructure - NEW
- Baseline testing scripts and procedures
- Pattern validation framework
- Risk management stress testing
- Quick monitoring and troubleshooting guides
- Comprehensive testing documentation

📊 Updated Implementation Plan
- Corrected completion status from 45% to 85%
- Phase 1 marked as complete with all tasks checked off
- Updated priority focus to Phase 3 (Visualization) or Phase 4 (Performance Tracking)

🔧 Technical Improvements
- Updated SniperEA.mq5 with debug mode enabled
- Compiled EA successfully (85KB .ex5 file)
- Validated all core functions through Strategy Tester
- Clean initialization and deinitialization confirmed

Next: Focus on Phase 3 (Chart Visualization) or Phase 4 (Performance Tracking)
2025-09-25 22:16:35 +07:00

235 lines
6.6 KiB
Markdown

# MT5 Sniper EA Testing & Monitoring Guide
## 🎯 Overview
This guide explains how to test and monitor your Sniper EA to verify it's working correctly after compilation.
## 📋 Quick Testing Checklist
### ✅ Phase 1: Initial Verification (5 minutes)
- [ ] EA compiles without errors (.ex5 file created)
- [ ] EA initializes on chart without crashes
- [ ] Information panel displays correctly
- [ ] Debug logs are visible in Experts tab
### ✅ Phase 2: Strategy Tester (30 minutes)
- [ ] Backtest runs without errors
- [ ] Pattern detection logs appear
- [ ] Multi-timeframe analysis works
- [ ] Risk management functions properly
### ✅ Phase 3: Demo Account (1-2 weeks)
- [ ] Live pattern detection
- [ ] Trade execution validation
- [ ] Position management testing
- [ ] Performance monitoring
## 🔧 Step-by-Step Testing Process
### 1. Strategy Tester Setup
**Open Strategy Tester:**
- Press `Ctrl+R` or `View → Strategy Tester`
**Configuration:**
```
Expert Advisor: SniperEA
Symbol: EURUSD (or major pair)
Period: M1 (1 minute)
Date Range: Last 1-3 months
Model: Every tick (most accurate)
Optimization: Disabled
```
**EA Parameters:**
```
EnableDetailedLogging = true
EnableDebugMode = true (you already set this ✓)
RiskPercent = 1.0
MaxTradesPerDay = 3
RequireMultiTFConfirmation = true
```
### 2. What to Look For in Logs
#### ✅ Successful Initialization
```
=== Sniper EA Initialization Started ===
Trading Symbols: 8
Risk per Trade: 1.0%
Minimum R:R Ratio: 2.0:1
=== Sniper EA Initialization Completed Successfully ===
```
#### ✅ Pattern Detection (Good Signs)
```
[PATTERN] SniperEA: Order Block detected on EURUSD - Bullish OB at 1.0850-1.0865, Strength: 1.25
[PATTERN] SniperEA: Fair Value Gap detected on EURUSD - Bullish FVG at 1.0860-1.0870, Size: 8.5 pips
[PATTERN] SniperEA: Break of Structure detected on EURUSD - Bullish BOS at 1.0875
[PATTERN] SniperEA: Liquidity Sweep detected on EURUSD - Low sweep at 1.0845, Distance: 12.3 pips
[PATTERN] SniperEA: Entry Opportunity - Bullish setup detected
```
#### ✅ Trade Execution (Success)
```
[TRADE] SniperEA: BULLISH SETUP EXECUTED on EURUSD - Entry: 1.0865, SL: 1.0845 (20.0 pips), TP: 1.0905 (2.0:1 RR), Lot: 0.10
[TRADE] SniperEA: BUY EXECUTED on EURUSD - Entry: 1.08650, SL: 1.08450, TP: 1.09050, Lot: 0.10
```
#### ✅ Multi-Timeframe Analysis
```
[DEBUG] SniperEA: Updating Multi-Timeframe Analysis for EURUSD
[DEBUG] SniperEA: Updating M1 analysis for EURUSD
[DEBUG] SniperEA: Found 3 Order Blocks on EURUSD M1
[DEBUG] SniperEA: Market Bias: BULLISH for EURUSD
```
### 3. Common Success Indicators
#### 📊 Information Panel (Top-left corner)
```
Sniper EA - ACTIVE
Session: LONDON
Balance: 10000.00
Equity: 10000.00
Margin: 0.00
Positions: 0/10
```
#### 📈 Expected Behavior
- **Pattern Detection**: Should find patterns every few hours
- **Trade Frequency**: 1-3 trades per symbol per day maximum
- **Risk Management**: Never risk more than 1% per trade
- **Session Filtering**: Only trades during allowed sessions
### 4. Warning Signs (What to Fix)
#### ❌ Initialization Errors
```
ERROR: Failed to setup symbols array
ERROR: Invalid input parameters
ERROR: Failed to initialize multi-timeframe analysis
```
**Solution**: Check symbol names and input parameters
#### ❌ No Pattern Detection
```
[DEBUG] SniperEA: No valid low sweep found for bullish setup on EURUSD
[DEBUG] SniperEA: M1 data not available or invalid for EURUSD
```
**Solution**: Ensure sufficient historical data is available
#### ❌ Trade Execution Failures
```
[ERROR] SniperEA: Invalid lot size calculated for EURUSD
[WARNING] SniperEA: Trade conditions not met for bullish trade on EURUSD
[ERROR] SniperEA: Sell Trade Execution failed with error 134: Not enough money
```
**Solution**: Check account balance and margin requirements
## 🔍 Monitoring Locations
### 1. MetaTrader 5 Experts Tab
- **Location**: `View → Toolbox → Experts`
- **Shows**: Real-time logs, errors, trade executions
- **Filter**: Look for "SniperEA" entries
### 2. Strategy Tester Results
- **Location**: Strategy Tester window after test completion
- **Shows**: Trade statistics, profit/loss, drawdown
- **Key Metrics**: Win rate, profit factor, maximum drawdown
### 3. Chart Information Panel
- **Location**: Top-left corner of chart
- **Shows**: EA status, session, account info, positions
- **Updates**: Real-time during operation
## 📊 Performance Expectations
### Target Metrics (After 1+ weeks of testing)
- **Win Rate**: 50-60%
- **Risk-Reward Ratio**: 2:1 minimum
- **Maximum Drawdown**: <15%
- **Trade Frequency**: 1-3 trades per symbol per day
- **Monthly Return**: 8-15% (target)
### Acceptable Ranges
- **Win Rate**: 45-65% (acceptable range)
- **Profit Factor**: >1.2 (good), >1.5 (excellent)
- **Maximum Consecutive Losses**: <5 trades
- **Average Trade Duration**: 2-8 hours
## 🚨 Troubleshooting Common Issues
### Issue: EA Not Trading
**Possible Causes:**
- Outside trading session hours
- No valid patterns detected
- Position limits reached
- Insufficient margin
**Check:**
1. Current session in info panel
2. Debug logs for pattern detection
3. Position count vs. limits
4. Account free margin
### Issue: Too Many/Few Trades
**Too Many Trades:**
- Reduce `MaxTradesPerDay`
- Increase `OBStrengthFilter`
- Enable `RequireMultiTFConfirmation`
**Too Few Trades:**
- Increase `MaxTradesPerDay`
- Decrease `MinFVGSize`
- Add more symbols to trade
### Issue: High Drawdown
**Solutions:**
- Reduce `RiskPercent` (try 0.5%)
- Increase `MinRR` ratio
- Enable stricter pattern filters
- Review stop loss placement
## 📝 Testing Log Template
Create a testing log to track your EA's performance:
```
Date: ___________
Testing Phase: [ ] Strategy Tester [ ] Demo [ ] Live
Symbol(s): ___________
Timeframe: M1
Initialization: [ ] Success [ ] Failed
Pattern Detection: [ ] Working [ ] Issues
Trade Execution: [ ] Working [ ] Issues
Risk Management: [ ] Working [ ] Issues
Notes:
_________________________________
_________________________________
Next Steps:
_________________________________
```
## 🎯 Next Steps After Testing
1. **If Strategy Tester Shows Good Results**: Move to demo account
2. **If Demo Account Performs Well**: Consider small live account
3. **If Issues Found**: Review logs, adjust parameters, retest
4. **Ongoing**: Monitor performance weekly, optimize as needed
## 📞 Support Resources
- **Compilation Issues**: Check MetaEditor error logs
- **Runtime Errors**: Monitor Experts tab in MT5
- **Performance Issues**: Analyze Strategy Tester reports
- **Pattern Detection**: Enable debug mode for detailed logs
---
**Remember**: Always test thoroughly on demo accounts before risking real money!