98507e3a47
Co-authored-by: Cursor <cursoragent@cursor.com>
227 lines
7.9 KiB
Markdown
227 lines
7.9 KiB
Markdown
# 🎯 Timeframe-Specific Breakout & Engulfing Confirmation
|
|
|
|
## 📋 **Overview**
|
|
|
|
Sistem konfirmasi breakout dan engulfing yang dioptimalkan untuk multi-timeframe trading, dimana konfirmasi hanya berlaku pada timeframe yang relevan untuk entry (M1/M5) dan tidak menghambat entry pada timeframe trend (H1).
|
|
|
|
## 🔧 **Fitur Utama**
|
|
|
|
### **1. Timeframe Awareness**
|
|
- **Entry Timeframe (M1/M5)**: Confirmation aktif untuk breakout dan engulfing
|
|
- **Setup Timeframe (M5)**: Confirmation aktif untuk breakout dan engulfing
|
|
- **Trend Timeframe (H1)**: Confirmation di-skip untuk menghindari hambatan entry
|
|
|
|
### **2. Conditional Confirmation Logic**
|
|
```mql5
|
|
bool ShouldApplyBreakoutConfirmation() {
|
|
return (EnableBreakoutConfirmation && breakoutConfirmationEnabled &&
|
|
(IsEntryTimeframe() || IsSetupTimeframe()));
|
|
}
|
|
|
|
bool ShouldApplyEngulfingConfirmation() {
|
|
return (EnableEngulfingConfirmation && engulfingConfirmationEnabled &&
|
|
(IsEntryTimeframe() || IsSetupTimeframe()));
|
|
}
|
|
```
|
|
|
|
### **3. Performance Optimization**
|
|
- **Caching System**: Mengurangi beban komputasi dengan cache 5 detik
|
|
- **Selective Detection**: Hanya mendeteksi pada timeframe yang diperlukan
|
|
- **Efficient Validation**: Skip validation pada timeframe trend
|
|
|
|
## 🎯 **Parameter Input**
|
|
|
|
### **Breakout Confirmation**
|
|
```mql5
|
|
input bool EnableBreakoutConfirmation = true; // Enable Breakout Confirmation
|
|
input int BreakoutLookback = 20; // Bars to look back for S/R levels
|
|
input double BreakoutThreshold = 0.0001; // Minimum breakout distance
|
|
input int BreakoutConfirmationBars = 2; // Bars to confirm breakout
|
|
input bool RequireVolumeSpike = true; // Require volume spike on breakout
|
|
input double VolumeSpikeMultiplier = 1.5; // Volume spike threshold
|
|
```
|
|
|
|
### **Engulfing Confirmation**
|
|
```mql5
|
|
input bool EnableEngulfingConfirmation = true; // Enable Engulfing Confirmation
|
|
input bool RequireStrongEngulfing = true; // Require strong engulfing (70%+)
|
|
input double EngulfingStrengthThreshold = 0.7; // Minimum engulfing strength
|
|
input bool CheckPreviousTrend = true; // Check previous trend direction
|
|
input int TrendLookback = 5; // Bars to check previous trend
|
|
input double MinEnhancedScore = 80.0; // Minimum enhanced score for entry
|
|
```
|
|
|
|
## 🎛️ **Toggle Buttons**
|
|
|
|
### **Dashboard Controls**
|
|
- **Breakout Toggle**: Enable/disable breakout confirmation
|
|
- **Engulfing Toggle**: Enable/disable engulfing confirmation
|
|
- **Real-time Status**: Menampilkan status confirmation per timeframe
|
|
|
|
### **Timeframe-Specific Display**
|
|
```
|
|
TF: M5 (Entry TF - Confirmation Active)
|
|
✅ Breakout: Breakout confirmed on M5
|
|
✅ Engulfing: Bullish Engulfing - Strength: 0.85 on M5
|
|
Total Score: 95.5 (Min: 80.0)
|
|
```
|
|
|
|
## 🔄 **Workflow**
|
|
|
|
### **1. Multi-Timeframe Strategy**
|
|
```
|
|
H1 (Trend) → M5 (Setup) → M1 (Entry)
|
|
↓ ↓ ↓
|
|
Skip Confirm Confirm
|
|
Detection Breakout Engulfing
|
|
```
|
|
|
|
### **2. Confirmation Process**
|
|
1. **MTF Analysis**: Validasi signal dengan multi-timeframe
|
|
2. **Timeframe Check**: Tentukan apakah confirmation diperlukan
|
|
3. **Pattern Detection**: Deteksi breakout/engulfing pada timeframe entry
|
|
4. **Score Calculation**: Hitung enhanced score
|
|
5. **Entry Decision**: Approve/reject berdasarkan total score
|
|
|
|
### **3. Performance Flow**
|
|
```
|
|
OnTick() → BuildSignal() → MTF Validation →
|
|
Timeframe Check → Pattern Detection →
|
|
Score Calculation → Entry Decision
|
|
```
|
|
|
|
## 📊 **Dashboard Integration**
|
|
|
|
### **Enhanced Status Display**
|
|
- **Timeframe Scope**: Menampilkan scope confirmation per timeframe
|
|
- **Pattern Status**: Status breakout dan engulfing dengan timeframe info
|
|
- **Score Display**: Total enhanced score dengan minimum threshold
|
|
- **Color Coding**:
|
|
- 🟢 Green: Confirmation active dan valid
|
|
- 🔴 Red: Confirmation active tapi tidak valid
|
|
- 🔵 Blue: Confirmation skipped untuk timeframe ini
|
|
|
|
### **Real-time Updates**
|
|
- **Status Changes**: Update real-time saat timeframe berubah
|
|
- **Pattern Detection**: Log pattern yang terdeteksi
|
|
- **Score Tracking**: Monitor enhanced score per timeframe
|
|
|
|
## 🎯 **Keuntungan**
|
|
|
|
### **1. Performance**
|
|
- **Reduced Load**: Tidak ada detection pada timeframe trend
|
|
- **Focused Analysis**: Hanya timeframe entry yang dianalisis
|
|
- **Cached Results**: Cache untuk mengurangi komputasi berulang
|
|
|
|
### **2. Accuracy**
|
|
- **Relevant Confirmation**: Confirmation hanya pada timeframe yang tepat
|
|
- **Reduced False Signals**: Menghindari false signals dari timeframe trend
|
|
- **Better Entry Timing**: Entry yang lebih tepat pada timeframe entry
|
|
|
|
### **3. User Experience**
|
|
- **Clear Feedback**: Dashboard yang informatif per timeframe
|
|
- **Easy Control**: Toggle buttons untuk kontrol real-time
|
|
- **Visual Status**: Status yang jelas dengan color coding
|
|
|
|
## 🔧 **Implementation Details**
|
|
|
|
### **Timeframe Detection Functions**
|
|
```mql5
|
|
bool IsEntryTimeframe() {
|
|
return (_Period == PERIOD_M1 || _Period == PERIOD_M5);
|
|
}
|
|
|
|
bool IsSetupTimeframe() {
|
|
return (_Period == PERIOD_M5);
|
|
}
|
|
|
|
bool IsTrendTimeframe() {
|
|
return (_Period == PERIOD_H1);
|
|
}
|
|
```
|
|
|
|
### **Caching System**
|
|
```mql5
|
|
struct TimeframeCache {
|
|
datetime lastCheck;
|
|
bool breakoutValid;
|
|
bool engulfingValid;
|
|
double breakoutLevel;
|
|
ENUM_ENGULFING_TYPE lastEngulfingType;
|
|
};
|
|
```
|
|
|
|
### **Enhanced Signal Calculation**
|
|
```mql5
|
|
void CalculateEnhancedSignalStrength(SignalPack &sp) {
|
|
double baseScore = sp.signalStrength;
|
|
double breakoutBonus = sp.breakoutConfirmed ? 30 * sp.breakoutStrength : 0;
|
|
double engulfingBonus = sp.engulfingConfirmed ? 25 * sp.engulfingStrength : 0;
|
|
sp.totalConfirmationScore = baseScore + breakoutBonus + engulfingBonus;
|
|
}
|
|
```
|
|
|
|
## 📈 **Usage Examples**
|
|
|
|
### **Scenario 1: H1 Trend Analysis**
|
|
- **Timeframe**: H1
|
|
- **Confirmation**: Skipped
|
|
- **Result**: Fast analysis, no pattern detection
|
|
- **Log**: "Trend Timeframe (H1) - Confirmation Skipped"
|
|
|
|
### **Scenario 2: M5 Setup Analysis**
|
|
- **Timeframe**: M5
|
|
- **Confirmation**: Active
|
|
- **Breakout**: Detected and confirmed
|
|
- **Engulfing**: Bullish engulfing detected
|
|
- **Result**: Enhanced score calculated
|
|
- **Log**: "Setup Timeframe (M5) - Confirmation Active"
|
|
|
|
### **Scenario 3: M1 Entry Analysis**
|
|
- **Timeframe**: M1
|
|
- **Confirmation**: Active
|
|
- **Patterns**: Both breakout and engulfing confirmed
|
|
- **Result**: High enhanced score, entry approved
|
|
- **Log**: "Entry Timeframe (M1) - Confirmation Active"
|
|
|
|
## 🎯 **Best Practices**
|
|
|
|
### **1. Configuration**
|
|
- **Enable pada M1/M5**: Aktifkan confirmation hanya pada timeframe entry
|
|
- **Disable pada H1**: Skip confirmation pada timeframe trend
|
|
- **Adjust Thresholds**: Sesuaikan MinEnhancedScore berdasarkan timeframe
|
|
|
|
### **2. Monitoring**
|
|
- **Watch Dashboard**: Monitor status confirmation per timeframe
|
|
- **Check Logs**: Perhatikan log untuk pattern detection
|
|
- **Track Performance**: Monitor enhanced score trends
|
|
|
|
### **3. Optimization**
|
|
- **Cache Settings**: Sesuaikan cache duration jika diperlukan
|
|
- **Threshold Tuning**: Optimalkan threshold berdasarkan market conditions
|
|
- **Toggle Usage**: Gunakan toggle buttons untuk kontrol real-time
|
|
|
|
## 🔄 **Future Enhancements**
|
|
|
|
### **1. Advanced Pattern Recognition**
|
|
- **Multiple Timeframe Patterns**: Pattern yang valid di multiple timeframe
|
|
- **Pattern Strength Scoring**: Scoring yang lebih sophisticated
|
|
- **Machine Learning Integration**: ML untuk pattern recognition
|
|
|
|
### **2. Enhanced Caching**
|
|
- **Dynamic Cache Duration**: Cache duration yang adaptif
|
|
- **Pattern Persistence**: Cache pattern yang bertahan lama
|
|
- **Memory Optimization**: Optimasi penggunaan memory
|
|
|
|
### **3. User Interface**
|
|
- **Interactive Dashboard**: Dashboard yang lebih interaktif
|
|
- **Pattern Visualization**: Visualisasi pattern pada chart
|
|
- **Real-time Alerts**: Alert untuk pattern detection
|
|
|
|
---
|
|
|
|
**Version**: 1.0
|
|
**Last Updated**: 2025-01-15
|
|
**Author**: SmartBot Development Team
|
|
|