Zenith-FX/MQL5/Experts/QuantumForexTrader/docs/TESTING_GUIDE.md

531 行
12 KiB
Markdown
Raw パーマリンク 通常表示 履歴

# Quantum Forex Trader - Testing & Validation Guide
## Purpose
This guide helps you systematically test and validate the Quantum Forex Trader EA before using it in live trading.
## Testing Phases
### Phase 1: Compilation Testing (5 minutes)
**Objective**: Ensure EA compiles without errors
**Steps**:
1. Open MetaEditor (F4 in MT5)
2. Open QuantumForexTrader_Scalper.mq5
3. Click Compile (F7)
4. Check results
**Expected Results**:
```
Compiling 'QuantumForexTrader_Scalper.mq5'...
Including: QuantumSignals.mqh
Including: QuantumAnalysis.mqh
Including: BinaryEncoder.mqh
Including: QuantumRiskManager.mqh
Result: 0 error(s), 0 warning(s)
Successfully compiled in XXX ms
```
**Pass Criteria**:
- ✅ 0 errors
- ✅ 0 warnings
- ✅ .ex5 file generated
**If Failed**:
- Check all .mqh files are present
- Verify file paths in #include statements
- Review error messages and fix syntax issues
---
### Phase 2: Initialization Testing (10 minutes)
**Objective**: Verify EA initializes correctly
**Setup**:
- Symbol: EUR/USD
- Timeframe: H1
- Account: Demo with $10,000
- Settings: Default (conservative)
**Steps**:
1. Attach EA to EUR/USD H1 chart
2. Use default settings
3. Check for smiley face ☺
4. Review Experts log
**Expected Log Output**:
```
=== Quantum Forex Trader Initializing ===
Symbol: EURUSD
Timeframe: H1
Account Balance: 10000.00
Account Equity: 10000.00
Account Leverage: 100
=== Configuration ===
History Bars: 256
Confidence Threshold: 3.0%
Momentum Threshold: 0.1
Risk Per Trade: 1.0%
Max Drawdown: 20.0%
Stop Loss: 50.0 pips
Take Profit: 100.0 pips
=== Quantum Forex Trader Initialized Successfully ===
```
**Pass Criteria**:
- ✅ Smiley face appears on chart
- ✅ Initialization success message in log
- ✅ No error messages
- ✅ All parameters displayed correctly
**If Failed**:
- Check "Allow Algo Trading" is enabled
- Verify account has sufficient balance
- Check symbol is available and tradeable
---
### Phase 3: Signal Generation Testing (1-2 hours)
**Objective**: Verify EA generates signals
**Setup**:
- Symbol: EUR/USD
- Timeframe: H1
- Settings: Moderate (more signals)
- InpConfidenceThreshold: 0.02
- InpMomentumThreshold: 0.08
**Monitoring**:
Watch Experts log for signal messages:
```
=== BUY SIGNAL DETECTED ===
Signal Type: BUY
Confidence: 3.50%
Momentum: 0.12
Trend: BULL
Time: 2025.01.15 10:30
```
**Pass Criteria**:
- ✅ Signals generated within 1-2 hours
- ✅ Signal info displays correctly
- ✅ Confidence and momentum values reasonable
- ✅ No error messages during signal generation
**Notes**:
- If no signals after 2 hours, this may be normal (market conditions)
- Check different pairs or timeframes
- Lower thresholds if needed for testing
---
### Phase 4: Trade Execution Testing (Demo Account, 1 week)
**Objective**: Verify EA opens and manages trades correctly
**Setup**:
- Account: Demo $10,000
- Symbol: EUR/USD
- Timeframe: H1
- Settings: Conservative
- InpRiskPercent: 0.5%
- InpMaxPositions: 1
**What to Check**:
#### A. Position Opening
- ✅ Positions open automatically when signals generated
- ✅ Lot size calculated correctly (~0.01-0.05 for $10k, 0.5% risk)
- ✅ Stop loss set correctly (50 pips from entry)
- ✅ Take profit set correctly (100 pips from entry)
- ✅ Magic number matches setting (777777)
#### B. Risk Management
- ✅ Only opens positions when conditions met
- ✅ Respects max position limit
- ✅ Doesn't exceed risk per trade
- ✅ Stops trading if drawdown exceeds limit
- ✅ Checks spread before opening
#### C. Trade Logging
Expected log messages:
```
Opening BUY position with lot size: 0.03
Buy position opened: EURUSD Lot: 0.03 SL: 1.08500 TP: 1.09500
=== Trade Transaction ===
Deal: 12345678
Symbol: EURUSD
Type: DEAL_TYPE_BUY
Volume: 0.03
Price: 1.09000
```
**Pass Criteria**:
- ✅ All trades logged with details
- ✅ SL/TP values correct
- ✅ Position sizes appropriate for risk setting
- ✅ No unexpected errors
- ✅ Risk limits enforced
---
### Phase 5: Strategy Tester Validation (2-3 hours)
**Objective**: Backtest EA on historical data
**Setup**:
1. Open Strategy Tester (Ctrl+R)
2. Select: QuantumForexTrader_Scalper
3. Settings:
- Symbol: EURUSD
- Period: H1
- Model: Every tick (most accurate)
- Date: 2024.01.01 to 2024.12.31 (1 year)
- Deposit: 10000
- Leverage: 100
- Optimization: Disabled (for now)
**Parameters**: Conservative
- InpRiskPercent: 1.0
- InpMaxPositions: 1
- InpStopLossPips: 50
- InpTakeProfitPips: 100
**Expected Results** (Approximate):
- Total Trades: 50-200
- Win Rate: 45-60%
- Profit Factor: 1.2-2.0
- Max Drawdown: 5-15%
- Sharpe Ratio: 0.5-1.5
**Pass Criteria**:
- ✅ Backtest completes without errors
- ✅ Reasonable number of trades
- ✅ Win rate > 40%
- ✅ Profit factor > 1.0
- ✅ Max drawdown < 20%
- ✅ No abnormal behavior (e.g., 100+ concurrent positions)
**Red Flags** (Investigate if you see):
- ❌ Win rate < 30%
- ❌ Profit factor < 0.8
- ❌ Max drawdown > 30%
- ❌ Hundreds of trades per day
- ❌ Very large losses on single trades
---
### Phase 6: Multi-Symbol Testing (1 week)
**Objective**: Test EA on multiple currency pairs
**Symbols to Test**:
1. EUR/USD (primary)
2. GBP/USD (high volatility)
3. USD/JPY (stable)
**Setup**:
- One chart per symbol
- Attach EA to each
- Use same conservative settings
- Monitor for 1 week
**Pass Criteria**:
- ✅ EA functions correctly on all pairs
- ✅ Different results per pair (expected)
- ✅ No correlation issues
- ✅ Total risk managed properly
- ✅ No unexpected interactions between instances
---
### Phase 7: Parameter Sensitivity Testing (Optional, 2-3 hours)
**Objective**: Understand how parameters affect performance
**Method**: Change one parameter at a time in Strategy Tester
#### Test A: Confidence Threshold
Test values: 0.01, 0.03, 0.05, 0.07
- Lower = more signals, possibly lower quality
- Higher = fewer signals, possibly higher quality
#### Test B: Risk Percent
Test values: 0.5%, 1.0%, 2.0%
- Lower = safer but slower growth
- Higher = faster growth but more risk
#### Test C: Stop Loss/Take Profit
Test combinations:
- 40/80 pips (tighter)
- 50/100 pips (default)
- 60/120 pips (wider)
**Document Results**:
Create a table comparing performance metrics for each setting.
---
### Phase 8: Stress Testing (1 week)
**Objective**: Test EA under adverse conditions
#### Test A: High Volatility Period
- Use backtest data during major news events
- Example: NFP release, FOMC meetings
- Check how EA handles spread widening
- Verify risk management holds
#### Test B: Low Volatility Period
- Use backtest data during quiet periods
- Example: Holiday periods, Asian sessions
- Check if EA trades (or correctly doesn't)
- Verify no false signals
#### Test C: Trend Reversal
- Find period with major trend change
- Check EA adapts correctly
- Verify signals change appropriately
**Pass Criteria**:
- ✅ EA doesn't overtrade during volatility
- ✅ Risk management prevents large losses
- ✅ EA adapts to market changes
- ✅ No crashes or hangs
---
## Testing Checklist
Use this checklist to track your testing progress:
### Compilation
- [ ] EA compiles without errors
- [ ] All include files found
- [ ] .ex5 file generated
- [ ] No warnings
### Initialization
- [ ] EA attaches to chart successfully
- [ ] Smiley face appears
- [ ] Initialization messages correct
- [ ] All parameters loaded
### Signal Generation
- [ ] Signals generated appropriately
- [ ] Signal details logged
- [ ] Confidence/momentum calculated
- [ ] No signal generation errors
### Trade Execution
- [ ] Trades open automatically
- [ ] Lot sizes correct
- [ ] SL/TP set properly
- [ ] Magic number correct
- [ ] Trade logging works
### Risk Management
- [ ] Risk per trade enforced
- [ ] Max positions enforced
- [ ] Drawdown protection works
- [ ] Spread filter active
- [ ] Position sizing accurate
### Strategy Tester
- [ ] Backtest runs completely
- [ ] Results reasonable
- [ ] No abnormal behavior
- [ ] Performance metrics acceptable
- [ ] Report generated
### Multi-Symbol
- [ ] Works on EUR/USD
- [ ] Works on GBP/USD
- [ ] Works on USD/JPY
- [ ] No interaction issues
- [ ] Total risk managed
### Documentation
- [ ] User manual reviewed
- [ ] Quick start followed
- [ ] All parameters understood
- [ ] Troubleshooting guide referenced
- [ ] FAQ consulted
## Performance Benchmarks
### Minimum Acceptable Performance
- Win Rate: > 40%
- Profit Factor: > 1.0
- Max Drawdown: < 25%
- Recovery Factor: > 2.0
- Sharpe Ratio: > 0.3
### Good Performance
- Win Rate: > 50%
- Profit Factor: > 1.3
- Max Drawdown: < 15%
- Recovery Factor: > 3.0
- Sharpe Ratio: > 0.8
### Excellent Performance
- Win Rate: > 60%
- Profit Factor: > 1.8
- Max Drawdown: < 10%
- Recovery Factor: > 5.0
- Sharpe Ratio: > 1.2
## Common Issues During Testing
### Issue: No signals generated
**Possible Causes**:
- Market conditions don't meet criteria
- Thresholds too high
- Not enough historical data
**Solutions**:
- Wait longer (signals may be infrequent)
- Lower confidence/momentum thresholds
- Check sufficient bars available
- Try different timeframe
### Issue: Too many trades
**Possible Causes**:
- Thresholds too low
- High market volatility
- Short signal interval
**Solutions**:
- Increase confidence threshold
- Increase momentum threshold
- Enable time filter
- Increase signal check interval
### Issue: Large losses
**Possible Causes**:
- Risk per trade too high
- Stop loss too wide
- Market conditions very adverse
**Solutions**:
- Reduce risk to 0.5%
- Review stop loss distance
- Check backtest period
- Ensure spread filter working
### Issue: EA stops trading
**Possible Causes**:
- Drawdown limit reached
- Max positions reached
- Account equity insufficient
**Solutions**:
- Check drawdown percentage
- Review position count
- Verify account balance
- Check for error messages
## Final Validation Checklist
Before going live, verify:
- [ ] Tested on demo for minimum 2 weeks
- [ ] Backtest shows positive results over 6+ months
- [ ] All testing phases completed successfully
- [ ] Understanding of all parameters
- [ ] Risk management validated
- [ ] No unexpected behavior observed
- [ ] Documentation reviewed thoroughly
- [ ] Emergency procedures understood
- [ ] Demo results meet expectations
- [ ] Starting with conservative settings
## Post-Testing Recommendations
### If All Tests Pass:
1. ✅ Consider live trading with small account
2. ✅ Start with same conservative settings
3. ✅ Monitor closely for first week
4. ✅ Keep detailed trading log
5. ✅ Review weekly performance
6. ✅ Adjust parameters gradually based on results
### If Tests Show Issues:
1. ⚠️ DO NOT go live
2. ⚠️ Review failed tests
3. ⚠️ Adjust parameters
4. ⚠️ Re-test thoroughly
5. ⚠️ Seek help if needed
6. ⚠️ Consider different approach
## Testing Log Template
Use this template to document your testing:
```
QUANTUM FOREX TRADER - TESTING LOG
Test Date: ___________
Tester Name: ___________
Account Type: Demo / Live
Initial Balance: $___________
PHASE 1: COMPILATION
Status: Pass / Fail
Errors: ___________
Notes: ___________
PHASE 2: INITIALIZATION
Status: Pass / Fail
Issues: ___________
Notes: ___________
PHASE 3: SIGNAL GENERATION
Duration: ___ hours
Signals Generated: ___
Status: Pass / Fail
Notes: ___________
PHASE 4: TRADE EXECUTION
Duration: ___ days
Trades Opened: ___
Trades Closed: ___
Win Rate: ___%
Max Drawdown: ___%
Status: Pass / Fail
Notes: ___________
PHASE 5: STRATEGY TESTER
Period Tested: ___________
Total Trades: ___
Win Rate: ___%
Profit Factor: ___
Max Drawdown: ___%
Sharpe Ratio: ___
Status: Pass / Fail
Notes: ___________
OVERALL ASSESSMENT:
Ready for Live: Yes / No
Recommended Settings: ___________
Action Items: ___________
Additional Notes: ___________
```
---
## Summary
Thorough testing is essential before live trading. Follow all phases systematically, document results, and only proceed to live trading when confident in EA performance. Remember:
- Testing takes time - don't rush
- Demo results don't guarantee live results
- Start conservatively
- Monitor continuously
- Adjust based on real performance
**Good luck with your testing!**