124 lines
4.5 KiB
Markdown
124 lines
4.5 KiB
Markdown
# MTF Conflict Signal Fix
|
|
|
|
## Masalah yang Diperbaiki
|
|
|
|
### 1. Konflik Sinyal MTF
|
|
**Sebelum perbaikan:**
|
|
```
|
|
🔍 MTF Strengths - H1: Buy=20.0 Sell=0.0 | M15: Buy=15.0 Sell=15.0 | M5: Buy=10.0 Sell=10.0 | M1: Buy=2.5 Sell=5.0
|
|
🔍 MTF Total Scores - Buy=47.5 Sell=30.0
|
|
🔎 MTF Scores → BUY=47.5 | SELL=30.0 | NET=17.5 | TOTAL=77.5
|
|
```
|
|
|
|
**Masalah:**
|
|
- M15 dan M5 memberikan sinyal Buy dan Sell secara bersamaan
|
|
- Total score 77.5 menunjukkan konflik sinyal yang tinggi
|
|
- H1 sell selalu 0, menunjukkan bias ke satu arah
|
|
|
|
### 2. Root Cause
|
|
- Sistem menghitung Buy dan Sell strength secara terpisah tanpa mutual exclusion
|
|
- Tidak ada logika untuk memilih sinyal yang lebih kuat
|
|
- Kondisi H1 sell mungkin terlalu ketat
|
|
|
|
## Solusi yang Diimplementasikan
|
|
|
|
### 1. Mutual Exclusion Logic
|
|
```mql5
|
|
// Sebelum: Kedua sinyal bisa aktif bersamaan
|
|
if(m15_buy_conditions >= 1) {
|
|
mtf.m15_buy = true;
|
|
mtf.m15_buy_strength = 30 * (m15_buy_conditions / 4.0);
|
|
}
|
|
if(m15_sell_conditions >= 1) {
|
|
mtf.m15_sell = true;
|
|
mtf.m15_sell_strength = 30 * (m15_sell_conditions / 4.0);
|
|
}
|
|
|
|
// Sesudah: Hanya sinyal yang lebih kuat yang aktif
|
|
if(m15_buy_conditions > m15_sell_conditions && m15_buy_conditions >= 1) {
|
|
mtf.m15_buy = true;
|
|
mtf.m15_sell = false;
|
|
mtf.m15_buy_strength = 30 * (m15_buy_conditions / 4.0);
|
|
mtf.m15_sell_strength = 0; // Reset sell strength
|
|
} else if(m15_sell_conditions > m15_buy_conditions && m15_sell_conditions >= 1) {
|
|
mtf.m15_sell = true;
|
|
mtf.m15_buy = false;
|
|
mtf.m15_sell_strength = 30 * (m15_sell_conditions / 4.0);
|
|
mtf.m15_buy_strength = 0; // Reset buy strength
|
|
}
|
|
```
|
|
|
|
### 2. Tie-Breaker Logic
|
|
```mql5
|
|
// Jika kondisi Buy dan Sell sama, gunakan EMA sebagai tie-breaker
|
|
} else if(m15_buy_conditions == m15_sell_conditions && m15_buy_conditions >= 2) {
|
|
if(m15_ema_up) {
|
|
mtf.m15_buy = true;
|
|
mtf.m15_sell = false;
|
|
// ... set buy strength
|
|
} else {
|
|
mtf.m15_sell = true;
|
|
mtf.m15_buy = false;
|
|
// ... set sell strength
|
|
}
|
|
}
|
|
```
|
|
|
|
### 3. Enhanced Logging
|
|
```mql5
|
|
// Log detail kondisi untuk debugging
|
|
EssentialLog("🔍 MTF Signal Details - H1: " + (mtf.h1_buy ? "BUY" : (mtf.h1_sell ? "SELL" : "NONE")) +
|
|
" | M15: " + (mtf.m15_buy ? "BUY" : (mtf.m15_sell ? "SELL" : "NONE")) +
|
|
" | M5: " + (mtf.m5_buy ? "BUY" : (mtf.m5_sell ? "SELL" : "NONE")) +
|
|
" | M1: " + (mtf.m1_buy ? "BUY" : (mtf.m1_sell ? "SELL" : "NONE")));
|
|
|
|
// Log dengan kondisi count
|
|
EssentialLog("🟢 H1 BUY Signal: Conditions=" + IntegerToString(h1_buy_conditions) + "/4 EMA=" + (h1_ema_up ? "UP" : "DOWN") +
|
|
" RSI=" + DoubleToString(h1_rsi, 1) + " ADX=" + DoubleToString(h1_adx, 1) + " Stoch=" + DoubleToString(h1_stoch_k, 1));
|
|
```
|
|
|
|
### 4. Improved Reason String
|
|
```mql5
|
|
// Menambahkan net score untuk clarity
|
|
if(buy_score > sell_score && buy_score >= 10) {
|
|
mtf.reason = "MTF BUY: " + buy_tfs + "Score: " + DoubleToString(buy_score, 1) + " (Net: " + DoubleToString(buy_score - sell_score, 1) + ")";
|
|
} else if(sell_score > buy_score && sell_score >= 10) {
|
|
mtf.reason = "MTF SELL: " + sell_tfs + "Score: " + DoubleToString(sell_score, 1) + " (Net: " + DoubleToString(sell_score - buy_score, 1) + ")";
|
|
}
|
|
```
|
|
|
|
## Hasil yang Diharapkan
|
|
|
|
### 1. Eliminasi Konflik Sinyal
|
|
- Setiap timeframe hanya akan memberikan satu sinyal (Buy ATAU Sell)
|
|
- Tidak ada lagi score yang sama untuk Buy dan Sell pada timeframe yang sama
|
|
|
|
### 2. H1 Sell Signal yang Lebih Baik
|
|
- Dengan mutual exclusion, H1 sell akan muncul ketika kondisi sell lebih kuat
|
|
- Logging yang lebih detail akan membantu debug mengapa H1 sell tidak muncul
|
|
|
|
### 3. Total Score yang Lebih Realistis
|
|
- Total score akan lebih rendah karena tidak ada penjumlahan konflik
|
|
- Net score akan lebih jelas menunjukkan arah yang dominan
|
|
|
|
### 4. Log yang Lebih Informatif
|
|
```
|
|
🔍 MTF Signal Details - H1: BUY | M15: SELL | M5: BUY | M1: NONE
|
|
🟢 H1 BUY Signal: Conditions=3/4 EMA=UP RSI=42.3 ADX=18.5 Stoch=25.1
|
|
🔴 M15 SELL Signal: Conditions=2/4 EMA=DOWN RSI=58.7 ADX=12.3 Stoch=75.2
|
|
🟢 M5 BUY Signal: Conditions=2/4 EMA=UP RSI=43.1 ADX=9.8 Stoch=28.9
|
|
⚪ M1 NO Signal: Buy=1 Sell=1
|
|
🔍 MTF Strengths - H1: Buy=40.0 Sell=0.0 | M15: Buy=0.0 Sell=15.0 | M5: Buy=10.0 Sell=0.0 | M1: Buy=0.0 Sell=0.0
|
|
🔍 MTF Total Scores - Buy=50.0 Sell=15.0
|
|
🔎 MTF Scores → BUY=50.0 | SELL=15.0 | NET=35.0 | TOTAL=65.0
|
|
```
|
|
|
|
## Testing
|
|
|
|
Setelah implementasi, monitor log untuk memastikan:
|
|
1. Tidak ada lagi konflik sinyal pada timeframe yang sama
|
|
2. H1 sell signal muncul ketika kondisi sell lebih kuat
|
|
3. Total score lebih realistis dan tidak terlalu tinggi
|
|
4. Net score memberikan arah yang jelas
|
|
|