4.6 KiB
4.6 KiB
MTF Trend-Following vs Mean-Reversion Mode
Fitur Baru yang Diterapkan
1. Mode Trading yang Fleksibel
Input Parameter Baru:
input ENUM_MTF_Mode MTF_TradingMode = MTF_MODE_MEAN_REVERSION; // MTF Trading Mode
input bool MTF_UseVoteTieBreaker = true; // Use vote majority as tie-breaker
// ADX Threshold Settings (lebih realistis)
input int MTF_ADX_H1_Threshold = 15; // H1 ADX Minimum (15-25 recommended)
input int MTF_ADX_M15_Threshold = 12; // M15 ADX Minimum (12-20 recommended)
input int MTF_ADX_M5_Threshold = 8; // M5 ADX Minimum (8-15 recommended)
input int MTF_ADX_M1_Threshold = 6; // M1 ADX Minimum (6-12 recommended)
2. Perbedaan Mode Trading
Mean-Reversion Mode (Default)
- RSI: Buy saat RSI < 50 (oversold), Sell saat RSI > 50 (overbought)
- Stochastic: Buy saat K < 40 (oversold), Sell saat K > 60 (overbought)
- Cocok untuk: Sideways market, range-bound trading
Trend-Following Mode
- RSI: Buy saat RSI >= 50 (bullish), Sell saat RSI <= 50 (bearish)
- Stochastic: Buy saat K >= 50 && K > D (bullish), Sell saat K <= 50 && K < D (bearish)
- Cocok untuk: Trending market, momentum trading
3. ADX Threshold yang Lebih Realistis
Sebelum:
- Semua timeframe: ADX >= 10
- Terlalu rendah, banyak false signal
Sesudah:
- H1: ADX >= 15 (15-25 recommended)
- M15: ADX >= 12 (12-20 recommended)
- M5: ADX >= 8 (8-15 recommended)
- M1: ADX >= 6 (6-12 recommended)
4. Vote Mayoritas sebagai Tie-Breaker
Fitur Baru:
- Menghitung jumlah timeframe yang memberikan sinyal buy vs sell
- Jika score buy dan sell hampir sama (selisih <= 5.0), gunakan vote mayoritas
- Mencegah kasus dimana 3 timeframe BUY tapi 1 SELL dengan score lebih tinggi
Contoh:
Score: Buy=25.0, Sell=27.0 (selisih=2.0)
Vote: Buy=3 (H1,M15,M5), Sell=1 (M1)
Result: BUY (vote tie-breaker: 3>1)
5. Helper Functions
GetMTFConditions()
void GetMTFConditions(bool ema_up, double rsi, double adx, double stoch_k, double stoch_d, int adx_threshold,
bool &rsi_buy, bool &rsi_sell, bool &adx_ok, bool &stoch_buy, bool &stoch_sell)
- Menentukan kondisi buy/sell berdasarkan mode trading
- ADX sebagai filter utama
CalculateMTFSignal()
void CalculateMTFSignal(bool ema_up, bool rsi_buy, bool rsi_sell, bool adx_ok, bool stoch_buy, bool stoch_sell,
double adx, int adx_threshold, double max_strength,
bool &buy_signal, bool &sell_signal, double &buy_strength, double &sell_strength,
string timeframe_name)
- Menghitung signal dan strength untuk setiap timeframe
- Mutual exclusion logic
- EMA sebagai tie-breaker
6. Perubahan Score Calculation
Sebelum:
- 4 kondisi: EMA, RSI, ADX, Stochastic
- Score: 40 * (conditions / 4.0)
- Bonus untuk kondisi kuat
Sesudah:
- 3 kondisi: EMA, RSI, Stochastic
- ADX sebagai filter (bukan kondisi)
- Score: 40 * (conditions / 3.0)
- Lebih sederhana dan konsisten
7. Cara Menggunakan
Untuk Mean-Reversion (Sideways Market):
MTF_TradingMode = MTF_MODE_MEAN_REVERSION
MTF_UseVoteTieBreaker = true
MTF_ADX_H1_Threshold = 15
MTF_ADX_M15_Threshold = 12
MTF_ADX_M5_Threshold = 8
MTF_ADX_M1_Threshold = 6
Untuk Trend-Following (Trending Market):
MTF_TradingMode = MTF_MODE_TREND_FOLLOWING
MTF_UseVoteTieBreaker = true
MTF_ADX_H1_Threshold = 20
MTF_ADX_M15_Threshold = 18
MTF_ADX_M5_Threshold = 15
MTF_ADX_M1_Threshold = 12
8. Keuntungan Implementasi
- Fleksibilitas: Bisa menyesuaikan dengan kondisi market
- Konsistensi: Logic yang sama untuk semua timeframe
- Filter yang Lebih Baik: ADX threshold yang realistis
- Tie-Breaker: Vote mayoritas mencegah konflik
- Maintainability: Helper functions memudahkan maintenance
9. Testing dan Monitoring
Log yang Ditambahkan:
- Mode trading yang aktif
- ADX threshold yang digunakan
- Vote count untuk tie-breaker
- Kondisi buy/sell untuk setiap timeframe
Dashboard Update:
- Menampilkan mode trading yang aktif
- Menampilkan vote count
- Menampilkan ADX threshold yang digunakan
10. Rekomendasi Penggunaan
Market Sideways (Range-bound):
- Gunakan Mean-Reversion Mode
- ADX threshold rendah (15-20)
- Fokus pada oversold/overbought levels
Market Trending:
- Gunakan Trend-Following Mode
- ADX threshold tinggi (20-25)
- Fokus pada momentum dan trend continuation
Market Volatile:
- Aktifkan Vote Tie-Breaker
- Gunakan ADX threshold menengah
- Monitor vote count untuk konfirmasi