mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-07-27 18:47:57 +00:00
e20b066d60
- Updated session input parameters with Cambodia timezone (GMT+7) - Modified GetCurrentSession() function to use Cambodia time offset - Adjusted session times to avoid midnight crossover complexity: * Asia Session: 07:00-16:00 Cambodia Time * London Session: 15:00-23:59 Cambodia Time * New York Session: 20:00-23:59 Cambodia Time - Updated documentation (README.md, PRD.md) to reflect timezone changes - Added debug logging for timezone verification - Prepared for Phase 3 implementation with proper Cambodia timezone support
271 lines
7.8 KiB
Markdown
271 lines
7.8 KiB
Markdown
# MT5 Expert Advisor - Sniper Strategy PRD
|
|
|
|
## Project Overview
|
|
|
|
### Product Name
|
|
|
|
MT5 Sniper Strategy Expert Advisor (OB + BOS + Liquidity Sweep + FVG)
|
|
|
|
### Product Vision
|
|
|
|
Develop a sophisticated MT5 Expert Advisor that implements institutional trading concepts to achieve consistent profitability across all forex pairs and Gold (XAUUSD) using advanced market structure analysis.
|
|
|
|
### Target Performance Metrics
|
|
|
|
- **Win Rate**: 50% to 60%
|
|
- **Risk per Trade**: 1% of account balance
|
|
- **Risk-Reward Ratio**: 2:1 to 3:1 minimum
|
|
- **Maximum Drawdown**: <15%
|
|
- **Monthly Return Target**: 8-15%
|
|
|
|
## Core Strategy Components
|
|
|
|
### 1. Market Structure Analysis
|
|
|
|
- **Order Blocks (OB)**: Identify institutional supply/demand zones
|
|
- **Break of Structure (BOS)**: Detect trend changes and continuation patterns
|
|
- **Liquidity Sweeps**: Identify stop-loss hunting patterns
|
|
- **Fair Value Gaps (FVG)**: Detect imbalances for entry opportunities
|
|
|
|
### 2. Multi-Timeframe Analysis
|
|
|
|
- **Primary Timeframe**: 1M (Entry signals)
|
|
- **Bias Timeframes**: 15M and H4 (Trend direction)
|
|
- **Structure Validation**: Daily and Weekly (Major levels)
|
|
|
|
## Functional Requirements
|
|
|
|
### 1. Trading Session Management
|
|
|
|
#### Asia Session
|
|
|
|
- **Time Range**: 07:00 - 16:00 Cambodia Time (GMT+7)
|
|
- **Characteristics**: Range-bound, lower volatility
|
|
- **Strategy Focus**: Liquidity sweep reversals
|
|
|
|
#### London Session
|
|
|
|
- **Time Range**: 15:00 - 23:59 Cambodia Time (GMT+7)
|
|
- **Characteristics**: High volatility, strong trends
|
|
- **Strategy Focus**: BOS continuation trades
|
|
|
|
#### New York Session
|
|
|
|
- **Time Range**: 20:00 - 23:59 Cambodia Time (GMT+7)
|
|
- **Characteristics**: High volume, institutional activity
|
|
- **Strategy Focus**: Order block reactions
|
|
|
|
### 2. Entry Logic Requirements
|
|
|
|
#### Primary Entry Conditions (All Must Be Met)
|
|
|
|
1. **Liquidity Sweep Detection**
|
|
|
|
- Price sweeps above/below equal highs/lows
|
|
- Minimum sweep distance: 5-10 pips
|
|
- Rejection candle formation required
|
|
|
|
2. **Break of Structure Confirmation**
|
|
|
|
- Clear BOS in opposite direction to sweep
|
|
- Structure break on 1M timeframe
|
|
- Confirmation within 3 candles
|
|
|
|
3. **Fair Value Gap Validation**
|
|
|
|
- FVG exists between BOS and Order Block
|
|
- Minimum gap size: 3 pips
|
|
- Gap not filled by subsequent price action
|
|
|
|
4. **Order Block Identification**
|
|
- Fresh OB in direction of structure shift
|
|
- OB formed within last 20 candles
|
|
- Clear rejection from OB zone
|
|
|
|
#### Entry Execution
|
|
|
|
- **Entry Point**: OB zone or FVG midpoint
|
|
- **Entry Method**: Market order or pending order
|
|
- **Maximum Slippage**: 2 pips
|
|
|
|
### 3. Risk Management System
|
|
|
|
#### Stop Loss Calculation
|
|
|
|
- **Method 1**: Just beyond Order Block (5-10 pips)
|
|
- **Method 2**: Beyond liquidity sweep wick (3-8 pips)
|
|
- **Maximum SL**: 50 pips
|
|
- **Minimum SL**: 10 pips
|
|
|
|
#### Take Profit Calculation
|
|
|
|
- **Primary TP**: 2:1 to 3:1 risk-reward ratio
|
|
- **Secondary TP**: Next HTF structure level
|
|
- **Partial Profit**: 50% at 1:1, remainder at 2:1 or 3:1
|
|
|
|
#### Position Sizing
|
|
|
|
- **Risk per Trade**: 1% of account balance
|
|
- **Maximum Positions**: 3 per symbol per day
|
|
- **Maximum Total Positions**: 10 across all symbols
|
|
|
|
### 4. Advanced Features
|
|
|
|
#### Grok AI Integration
|
|
|
|
- **Fundamental Analysis**: Economic calendar integration
|
|
- **Sentiment Analysis**: Market sentiment scoring
|
|
- **News Impact**: High-impact news filtering
|
|
- **AI Confidence Score**: Trade quality assessment (1-10)
|
|
|
|
#### Data Processing Pipeline
|
|
|
|
- **Real-time Data**: Price action analysis
|
|
- **Historical Data**: Pattern recognition training
|
|
- **Market Conditions**: Volatility and trend assessment
|
|
- **Performance Analytics**: Trade outcome analysis
|
|
|
|
## Technical Requirements
|
|
|
|
### 1. MQL5 Implementation Standards
|
|
|
|
- **Code Structure**: Modular design with separate classes
|
|
- **Error Handling**: Comprehensive try-catch blocks
|
|
- **Logging**: Detailed trade and system logs
|
|
- **Performance**: Optimized for real-time execution
|
|
|
|
### 2. Configuration Parameters
|
|
|
|
#### Core Settings
|
|
|
|
```
|
|
MaxTradesPerDay = 3 // Maximum trades per symbol per day
|
|
RiskPercent = 1.0 // Risk percentage per trade
|
|
MinRR = 2.0 // Minimum risk-reward ratio
|
|
UseTimeFilter = true // Enable session filtering
|
|
```
|
|
|
|
#### Session Settings
|
|
|
|
```
|
|
AsiaStart = "07:00" // Asia session start (Cambodia Time GMT+7)
|
|
AsiaEnd = "16:00" // Asia session end (Cambodia Time GMT+7)
|
|
LondonStart = "15:00" // London session start (Cambodia Time GMT+7)
|
|
LondonEnd = "23:59" // London session end (Cambodia Time GMT+7)
|
|
NYStart = "20:00" // New York session start (Cambodia Time GMT+7)
|
|
NYEnd = "23:59" // New York session end (Cambodia Time GMT+7)
|
|
```
|
|
|
|
#### Symbol Configuration
|
|
|
|
```
|
|
SymbolsToTrade = ["EURUSD", "GBPUSD", "USDJPY", "USDCHF", "AUDUSD", "USDCAD", "NZDUSD", "XAUUSD"]
|
|
```
|
|
|
|
### 3. Backtesting Framework
|
|
|
|
- **Historical Data**: Minimum 2 years of tick data
|
|
- **Testing Period**: 2020-2024
|
|
- **Validation Method**: Walk-forward analysis
|
|
- **Optimization**: Genetic algorithm for parameter tuning
|
|
|
|
### 4. Performance Monitoring
|
|
|
|
- **Real-time Metrics**: Win rate, profit factor, drawdown
|
|
- **Daily Reports**: Trade summary and performance analysis
|
|
- **Weekly Analysis**: Strategy effectiveness review
|
|
- **Monthly Optimization**: Parameter adjustment recommendations
|
|
|
|
## User Interface Requirements
|
|
|
|
### 1. Chart Visualization
|
|
|
|
- **Order Blocks**: Rectangular zones with transparency
|
|
- **Fair Value Gaps**: Shaded areas with distinct colors
|
|
- **Break of Structure**: Arrows and labels
|
|
- **Liquidity Sweeps**: Icons (🔺/🔻) with annotations
|
|
- **Entry/SL/TP**: Horizontal lines with labels
|
|
|
|
### 2. Information Panel
|
|
|
|
- **Current Session**: Active trading session display
|
|
- **AI Sentiment**: Grok AI analysis summary
|
|
- **Trade Status**: Active positions and pending orders
|
|
- **Performance Metrics**: Real-time statistics
|
|
|
|
## Quality Assurance
|
|
|
|
### 1. Testing Requirements
|
|
|
|
- **Unit Testing**: Individual function validation
|
|
- **Integration Testing**: Component interaction testing
|
|
- **Performance Testing**: Speed and resource usage
|
|
- **Stress Testing**: High-volume market conditions
|
|
|
|
### 2. Validation Methodology
|
|
|
|
- **Strategy Validation**: Historical performance analysis
|
|
- **Risk Validation**: Maximum drawdown testing
|
|
- **Robustness Testing**: Different market conditions
|
|
- **Forward Testing**: Live market validation
|
|
|
|
## Compliance and Risk Management
|
|
|
|
### 1. Regulatory Compliance
|
|
|
|
- **Broker Compatibility**: Major MT5 brokers
|
|
- **Execution Standards**: FIFO compliance where required
|
|
- **Risk Disclosure**: Clear risk warnings
|
|
- **Documentation**: Comprehensive user manual
|
|
|
|
### 2. Risk Controls
|
|
|
|
- **Maximum Risk**: 1% per trade, 5% per day
|
|
- **Emergency Stop**: Account equity protection
|
|
- **News Filter**: High-impact event avoidance
|
|
- **Market Hours**: Respect trading session limits
|
|
|
|
## Success Criteria
|
|
|
|
### 1. Performance Targets
|
|
|
|
- Achieve 50-60% win rate over 6-month period
|
|
- Maintain 2:1 minimum risk-reward ratio
|
|
- Generate consistent monthly returns of 8-15%
|
|
- Keep maximum drawdown below 15%
|
|
|
|
### 2. Technical Targets
|
|
|
|
- Execute trades within 100ms of signal generation
|
|
- Maintain 99.9% uptime during trading hours
|
|
- Process AI analysis within 5 seconds
|
|
- Handle minimum 10 concurrent symbol monitoring
|
|
|
|
## Timeline and Milestones
|
|
|
|
### Phase 1: Core Development (Weeks 1-2)
|
|
|
|
- Basic EA structure and initialization
|
|
- Core trading logic implementation
|
|
- Risk management system
|
|
|
|
### Phase 2: Advanced Features (Weeks 3-4)
|
|
|
|
- Multi-timeframe analysis
|
|
- Session management
|
|
- Chart visualization
|
|
|
|
### Phase 3: AI Integration (Weeks 5-6)
|
|
|
|
- Grok AI integration
|
|
- Data processing pipeline
|
|
- Performance analytics
|
|
|
|
### Phase 4: Testing and Optimization (Weeks 7-8)
|
|
|
|
- Backtesting framework
|
|
- Strategy validation
|
|
- Performance optimization
|
|
|
|
This PRD serves as the foundation for implementing a sophisticated MT5 Expert Advisor that combines institutional trading concepts with modern AI analysis to achieve consistent trading performance.
|