474 lignes
13 Kio
Text
474 lignes
13 Kio
Text
|
|
===========================================
|
||
|
|
QuantumForexTrader EA - Complete Usage Instructions
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
VERSION: 1.0
|
||
|
|
CREATED: 2024
|
||
|
|
BASED ON: IBM Quantum Phase Estimation Theory
|
||
|
|
ARTICLE: https://www.mql5.com/en/articles/17171
|
||
|
|
TARGET WIN RATE: 60-70%
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
TABLE OF CONTENTS
|
||
|
|
===========================================
|
||
|
|
1. Overview
|
||
|
|
2. What's Included
|
||
|
|
3. Installation
|
||
|
|
4. Configuration
|
||
|
|
5. EA Variants
|
||
|
|
6. Quantum Features
|
||
|
|
7. Trading Strategies
|
||
|
|
8. Risk Management
|
||
|
|
9. Best Practices
|
||
|
|
10. Troubleshooting
|
||
|
|
11. Performance Monitoring
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
1. OVERVIEW
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
The QuantumForexTrader EA combines:
|
||
|
|
- Traditional V3 Multi-Strategy features (MA, RSI, BB, MACD)
|
||
|
|
- Quantum Phase Estimation (QPE) algorithm
|
||
|
|
- Binary price encoding (256 candles)
|
||
|
|
- Quantum probability distribution analysis
|
||
|
|
- Adaptive risk management based on quantum confidence
|
||
|
|
- Multi-timeframe quantum analysis
|
||
|
|
|
||
|
|
Key Innovation:
|
||
|
|
Uses quantum-inspired algorithms to analyze market states
|
||
|
|
simultaneously, providing probability distributions for future
|
||
|
|
price movements. Target win rate: 60-70% based on IBM research.
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
2. WHAT'S INCLUDED
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
EA Files:
|
||
|
|
- QuantumForexTrader_Base.mq5 (Main EA - 1398 lines)
|
||
|
|
- QuantumForexTrader_Scalper.mq5 (Scalper variant - 612 lines)
|
||
|
|
|
||
|
|
Include Files (Helpers):
|
||
|
|
- QuantumSignals.mqh - Signal generation
|
||
|
|
- QuantumAnalysis.mqh - Market state analysis
|
||
|
|
- BinaryEncoder.mqh - Price encoding functions
|
||
|
|
- QuantumRiskManager.mqh - Risk management
|
||
|
|
- PythonBridge.mqh - Optional Python integration
|
||
|
|
|
||
|
|
Configuration Files:
|
||
|
|
- QuantumForexTrader_Base.set - Default settings
|
||
|
|
- QuantumForexTrader_Scalper.set - Scalper settings
|
||
|
|
- QuantumForexTrader_Base.ini - Configuration
|
||
|
|
- QuantumForexTrader_Scalper.ini - Scalper config
|
||
|
|
|
||
|
|
Python Scripts (Optional):
|
||
|
|
- quantum_analysis.py - Quantum calculations
|
||
|
|
- quantum_visual.py - Visual analysis
|
||
|
|
- run_quantum_python.bat - Auto-runner
|
||
|
|
- PYTHON_COMMANDS.txt - Instructions
|
||
|
|
|
||
|
|
Documentation:
|
||
|
|
- USAGE_INSTRUCTIONS.txt (this file)
|
||
|
|
- INSTALLATION.txt - Step-by-step setup
|
||
|
|
- CONFIGURATION.txt - Parameter guide
|
||
|
|
- QUANTUM_THEORY.txt - Theory explanation
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
3. INSTALLATION
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
Quick Installation:
|
||
|
|
1. Copy entire FOREX_TRADER folder to:
|
||
|
|
MT5_Terminal/MQL5/Experts/
|
||
|
|
|
||
|
|
2. Restart MetaTrader 5 or press F4 and click "Refresh"
|
||
|
|
|
||
|
|
3. Find EA in Navigator: Experts -> FOREX_TRADER
|
||
|
|
|
||
|
|
4. Drag EA onto chart
|
||
|
|
|
||
|
|
5. Enable AutoTrading (press F7 or click AutoTrading button)
|
||
|
|
|
||
|
|
Detailed installation instructions in INSTALLATION.txt
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
4. CONFIGURATION
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
Quick Start - Use Presets:
|
||
|
|
- For balanced trading: Load QuantumForexTrader_Base.set
|
||
|
|
- For scalping: Load QuantumForexTrader_Scalper.set
|
||
|
|
|
||
|
|
Key Parameters to Adjust:
|
||
|
|
|
||
|
|
Quantum Settings:
|
||
|
|
- QuantumConfidenceThreshold: 60% (decrease for more trades, increase for fewer)
|
||
|
|
- QuantumWeight: 0.6 (60% quantum, 40% classical)
|
||
|
|
- QuantumLookback: 256 candles (optimal for quantum efficiency)
|
||
|
|
|
||
|
|
Risk Settings:
|
||
|
|
- BaseRiskPercent: 1.5% (adjust based on risk tolerance)
|
||
|
|
- MaxConcurrentPositions: 5 (reduce for conservative approach)
|
||
|
|
- MaxDrawdownPercent: 30% (EA stops at this level)
|
||
|
|
|
||
|
|
Strategy Settings:
|
||
|
|
- MinSignalScore: 60 (increase for higher quality signals)
|
||
|
|
- UseQuantumMTF: true (multi-timeframe quantum confirmation)
|
||
|
|
|
||
|
|
Full parameter guide in CONFIGURATION.txt
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
5. EA VARIANTS
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
A) QuantumForexTrader_Base (Recommended for Beginners)
|
||
|
|
|
||
|
|
Purpose: General purpose quantum-enhanced trading
|
||
|
|
Timeframes: M15, M30, H1
|
||
|
|
Holding Period: Hours to days
|
||
|
|
Risk per Trade: 1.5%
|
||
|
|
Max Daily Trades: 20
|
||
|
|
|
||
|
|
Features:
|
||
|
|
- All 4 strategies enabled
|
||
|
|
- Multi-timeframe analysis
|
||
|
|
- Quantum probability matrix
|
||
|
|
- Adaptive risk management
|
||
|
|
- Full position management
|
||
|
|
|
||
|
|
Best For:
|
||
|
|
- Trend trading
|
||
|
|
- Swing trading
|
||
|
|
- Medium-term positions
|
||
|
|
- EURUSD, GBPUSD, USDJPY
|
||
|
|
|
||
|
|
B) QuantumForexTrader_Scalper (For Experienced Traders)
|
||
|
|
|
||
|
|
Purpose: Fast quantum-enhanced scalping
|
||
|
|
Timeframes: M1, M5
|
||
|
|
Holding Period: Minutes (max 30)
|
||
|
|
Risk per Scalp: 0.5%
|
||
|
|
Max Daily Scalps: 50
|
||
|
|
|
||
|
|
Features:
|
||
|
|
- Fast quantum calculations
|
||
|
|
- Quick entry/exit logic
|
||
|
|
- Time-based exit
|
||
|
|
- Tight breakeven
|
||
|
|
- High activity trading only
|
||
|
|
|
||
|
|
Best For:
|
||
|
|
- Scalping
|
||
|
|
- Quick profits
|
||
|
|
- High volume trading
|
||
|
|
- Major pairs with low spread
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
6. QUANTUM FEATURES
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
Quantum Phase Estimation (QPE):
|
||
|
|
- Simulates 22-qubit quantum circuit
|
||
|
|
- Analyzes 256 candles of price history
|
||
|
|
- Generates probability distribution for 10 future candles
|
||
|
|
- Based on IBM Quantum research
|
||
|
|
|
||
|
|
Binary Price Encoding:
|
||
|
|
- Converts price movements to binary sequence
|
||
|
|
- 1 = price increased, 0 = price decreased
|
||
|
|
- Creates quantum-ready state representation
|
||
|
|
- Enables pattern analysis
|
||
|
|
|
||
|
|
Quantum Market State Analysis:
|
||
|
|
- Calculates probability matrix
|
||
|
|
- Measures quantum entropy (uncertainty)
|
||
|
|
- Determines trend confidence
|
||
|
|
- Identifies dominant market state
|
||
|
|
|
||
|
|
Quantum Risk Management:
|
||
|
|
- Adjusts position size based on quantum confidence
|
||
|
|
- Adapts SL/TP based on quantum entropy
|
||
|
|
- Evaluates trade quality (0-100 score)
|
||
|
|
- Calculates optimal trailing stop distance
|
||
|
|
|
||
|
|
Quantum Signal Generation:
|
||
|
|
- Combines classical indicators with quantum probabilities
|
||
|
|
- Weighted signal scoring (60% quantum + 40% classical)
|
||
|
|
- Confidence threshold filtering
|
||
|
|
- Direction confirmation across timeframes
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
7. TRADING STRATEGIES
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
The EA uses 4 classical strategies enhanced with quantum analysis:
|
||
|
|
|
||
|
|
1. Moving Average Crossover
|
||
|
|
- Fast MA (10) crosses Slow MA (50)
|
||
|
|
- Quantum confirms trend direction
|
||
|
|
- Slope and distance filters
|
||
|
|
|
||
|
|
2. RSI Reversal
|
||
|
|
- Oversold/Overbought bounce
|
||
|
|
- Quantum predicts reversal probability
|
||
|
|
- RSI periods: 14 (Base), 9 (Scalper)
|
||
|
|
|
||
|
|
3. Bollinger Bands
|
||
|
|
- Bounce from bands
|
||
|
|
- Quantum analyzes mean reversion probability
|
||
|
|
- Dynamic bands based on volatility
|
||
|
|
|
||
|
|
4. MACD
|
||
|
|
- Signal line crossover
|
||
|
|
- Quantum confirms momentum
|
||
|
|
- Divergence detection
|
||
|
|
|
||
|
|
Quantum Enhancement:
|
||
|
|
- Each strategy generates classical score (0-30 points)
|
||
|
|
- Quantum analysis adds confidence layer
|
||
|
|
- Combined score determines entry
|
||
|
|
- Minimum score threshold filters weak signals
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
8. RISK MANAGEMENT
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
Multi-Layer Risk Protection:
|
||
|
|
|
||
|
|
1. Position Sizing
|
||
|
|
- Quantum-adjusted lot size based on confidence
|
||
|
|
- Maximum risk per trade: configurable
|
||
|
|
- Portfolio risk limit: 10% default
|
||
|
|
|
||
|
|
2. Stop Loss / Take Profit
|
||
|
|
- ATR-based dynamic sizing
|
||
|
|
- Quantum entropy adjustment
|
||
|
|
- Minimum protection levels
|
||
|
|
|
||
|
|
3. Position Management
|
||
|
|
- Breakeven move at profit threshold
|
||
|
|
- Partial take profit (50% default)
|
||
|
|
- Quantum-enhanced trailing stop
|
||
|
|
|
||
|
|
4. Portfolio Controls
|
||
|
|
- Maximum concurrent positions
|
||
|
|
- Daily trade limits
|
||
|
|
- Session filters
|
||
|
|
- Cooldown between trades
|
||
|
|
|
||
|
|
5. Emergency Protection
|
||
|
|
- Max drawdown limit (auto-halt)
|
||
|
|
- Spread filter
|
||
|
|
- Volatility range filter
|
||
|
|
- Market state validation
|
||
|
|
|
||
|
|
Quantum Risk Features:
|
||
|
|
- Risk scales with confidence (high confidence = larger position)
|
||
|
|
- Entropy-based stop adjustment (high uncertainty = wider stops)
|
||
|
|
- Trade quality scoring prevents low-probability entries
|
||
|
|
- Dynamic trailing based on quantum trend strength
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
9. BEST PRACTICES
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
For Best Results:
|
||
|
|
|
||
|
|
1. Backtesting
|
||
|
|
- Test on 6-12 months historical data
|
||
|
|
- Use "Every tick" mode
|
||
|
|
- Optimize on training data
|
||
|
|
- Validate on out-of-sample data
|
||
|
|
|
||
|
|
2. Forward Testing
|
||
|
|
- Run on demo account 2-4 weeks minimum
|
||
|
|
- Monitor quantum win rate
|
||
|
|
- Track confidence levels
|
||
|
|
- Adjust parameters based on performance
|
||
|
|
|
||
|
|
3. Live Trading Start
|
||
|
|
- Begin with minimum lot size
|
||
|
|
- Use conservative settings
|
||
|
|
- Monitor first 20-30 trades
|
||
|
|
- Gradually increase risk if profitable
|
||
|
|
|
||
|
|
4. Parameter Optimization
|
||
|
|
- QuantumConfidenceThreshold: Key parameter
|
||
|
|
- Start high (65-70%) for quality
|
||
|
|
- Lower (55-60%) for more trades
|
||
|
|
- Monitor win rate vs threshold
|
||
|
|
|
||
|
|
5. Timeframe Selection
|
||
|
|
- Base EA: M15-H1 recommended
|
||
|
|
- Scalper: M1-M5 only
|
||
|
|
- Higher timeframes = fewer but better trades
|
||
|
|
- Lower timeframes = more trades, needs tight spread
|
||
|
|
|
||
|
|
6. Pair Selection
|
||
|
|
- Major pairs recommended (EURUSD, GBPUSD, USDJPY)
|
||
|
|
- Low spread essential (especially scalping)
|
||
|
|
- High liquidity preferred
|
||
|
|
- Avoid exotic pairs initially
|
||
|
|
|
||
|
|
7. Session Trading
|
||
|
|
- London session: Best for trends
|
||
|
|
- NY session: High volatility
|
||
|
|
- Asian session: Range-bound (avoid for trending strategies)
|
||
|
|
- Overlap periods: Highest activity
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
10. TROUBLESHOOTING
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
EA Not Trading:
|
||
|
|
- Check AutoTrading is enabled (F7)
|
||
|
|
- Verify account allows automated trading
|
||
|
|
- Check quantum confidence threshold not too high
|
||
|
|
- Review spread filter (may be rejecting trades)
|
||
|
|
- Check session filter settings
|
||
|
|
- Verify daily trade limit not reached
|
||
|
|
|
||
|
|
Low Win Rate (<50%):
|
||
|
|
- Increase QuantumConfidenceThreshold
|
||
|
|
- Enable more filters (ADX, ATR)
|
||
|
|
- Reduce MaxConcurrentPositions
|
||
|
|
- Check if market conditions changed
|
||
|
|
- Review quantum entropy levels
|
||
|
|
- Consider different timeframe
|
||
|
|
|
||
|
|
Too Few Trades:
|
||
|
|
- Decrease QuantumConfidenceThreshold
|
||
|
|
- Lower MinSignalScore
|
||
|
|
- Increase MaxSpreadPips
|
||
|
|
- Extend trading sessions
|
||
|
|
- Enable more strategies
|
||
|
|
- Check cooldown settings
|
||
|
|
|
||
|
|
Compilation Errors:
|
||
|
|
- Ensure all Include files are in Include folder
|
||
|
|
- Check folder structure is correct
|
||
|
|
- Verify MQL5 version is up to date
|
||
|
|
- Review syntax errors in log
|
||
|
|
- Recompile with F7 in MetaEditor
|
||
|
|
|
||
|
|
Runtime Errors:
|
||
|
|
- Check indicator handles are valid
|
||
|
|
- Verify sufficient bar history
|
||
|
|
- Review memory usage
|
||
|
|
- Check for symbol/timeframe mismatch
|
||
|
|
- Examine expert log for details
|
||
|
|
|
||
|
|
Python Integration Issues:
|
||
|
|
- Python integration is OPTIONAL
|
||
|
|
- EA works fully without Python
|
||
|
|
- See PYTHON_COMMANDS.txt for setup
|
||
|
|
- Check Python installation and packages
|
||
|
|
- Verify file paths in configuration
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
11. PERFORMANCE MONITORING
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
Key Metrics to Track:
|
||
|
|
|
||
|
|
1. Quantum Performance
|
||
|
|
- Quantum win rate (target: 60-70%)
|
||
|
|
- Average quantum confidence
|
||
|
|
- Quantum vs classical signal performance
|
||
|
|
- Entropy correlation with outcomes
|
||
|
|
|
||
|
|
2. Trading Performance
|
||
|
|
- Overall win rate
|
||
|
|
- Profit factor (target: >1.5)
|
||
|
|
- Maximum drawdown
|
||
|
|
- Average trade duration
|
||
|
|
- Risk/reward ratio
|
||
|
|
|
||
|
|
3. Strategy Performance
|
||
|
|
- Individual strategy win rates
|
||
|
|
- MA, RSI, BB, MACD effectiveness
|
||
|
|
- Multi-timeframe confirmation rate
|
||
|
|
- Signal score distribution
|
||
|
|
|
||
|
|
4. Risk Metrics
|
||
|
|
- Current portfolio exposure
|
||
|
|
- Daily profit/loss
|
||
|
|
- Consecutive losses
|
||
|
|
- Largest losing trade
|
||
|
|
- Recovery factor
|
||
|
|
|
||
|
|
How to Monitor:
|
||
|
|
- Check EA logs in MT5 Experts tab
|
||
|
|
- Review strategy performance printout (on deinit)
|
||
|
|
- Analyze trading history in MT5
|
||
|
|
- Use MT5 Strategy Tester for backtests
|
||
|
|
- Export trade history to Excel for analysis
|
||
|
|
|
||
|
|
Quantum-Specific Monitoring:
|
||
|
|
- Log shows quantum signal generation
|
||
|
|
- Confidence levels printed for each signal
|
||
|
|
- Quantum state description displayed
|
||
|
|
- Trend strength indicators logged
|
||
|
|
- Entropy levels recorded
|
||
|
|
|
||
|
|
Performance Optimization:
|
||
|
|
- If win rate < 55%: Increase confidence threshold
|
||
|
|
- If win rate > 75%: May decrease threshold for more trades
|
||
|
|
- If high entropy often: Enable quantum filters
|
||
|
|
- If low quantum score: Review lookback period
|
||
|
|
- Track best performing quantum confidence range
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
SUPPORT AND UPDATES
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
GitHub Repository:
|
||
|
|
https://github.com/simonokwundue-ops/Experienced-FX-Trader
|
||
|
|
|
||
|
|
For issues or questions:
|
||
|
|
- Check documentation files
|
||
|
|
- Review troubleshooting section
|
||
|
|
- Examine EA logs for error messages
|
||
|
|
- Test on demo account first
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
DISCLAIMER
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
IMPORTANT: Trading forex carries substantial risk of loss.
|
||
|
|
- Test thoroughly on demo accounts
|
||
|
|
- Never risk more than you can afford to lose
|
||
|
|
- Past performance does not guarantee future results
|
||
|
|
- Quantum analysis improves probabilities but doesn't guarantee profit
|
||
|
|
- Monitor performance regularly
|
||
|
|
- Use appropriate risk management
|
||
|
|
- Start with minimum position sizes
|
||
|
|
|
||
|
|
The 60-70% win rate target is based on IBM Quantum research
|
||
|
|
and backtesting. Actual results may vary based on market
|
||
|
|
conditions, broker, settings, and timeframe.
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
LICENSE
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
MIT License - See repository for details
|
||
|
|
|
||
|
|
Based on IBM Quantum Phase Estimation concepts
|
||
|
|
Implements quantum-inspired algorithms in MQL5
|
||
|
|
Production-ready and fully standalone
|
||
|
|
|
||
|
|
===========================================
|
||
|
|
VERSION HISTORY
|
||
|
|
===========================================
|
||
|
|
|
||
|
|
v1.0 - Initial Release
|
||
|
|
- Complete quantum integration
|
||
|
|
- Base and Scalper variants
|
||
|
|
- All V3 production features
|
||
|
|
- Comprehensive documentation
|
||
|
|
- Python integration support
|
||
|
|
- Full error handling
|
||
|
|
- Production-ready code
|
||
|
|
|
||
|
|
===========================================
|