291 lines
7.9 KiB
Plaintext
291 lines
7.9 KiB
Plaintext
//+------------------------------------------------------------------+
|
|
//| XAUUSD_Optimized.mq5 |
|
|
//| SmartBot Configuration for XAUUSD (Gold) |
|
|
//+------------------------------------------------------------------+
|
|
|
|
/*
|
|
XAUUSD (GOLD) OPTIMIZED CONFIGURATION
|
|
=====================================
|
|
|
|
Karakteristik XAUUSD:
|
|
- High volatility (bisa bergerak 50-200 USD per hari)
|
|
- High spread (biasanya 20-50 points)
|
|
- Sensitif terhadap news ekonomi dan geopolitik
|
|
- Trading volume tinggi di London & NY sessions
|
|
- Sering ranging dengan breakout yang kuat
|
|
|
|
Setting ini dioptimalkan untuk:
|
|
- Mengurangi risiko karena volatilitas tinggi
|
|
- Memaksimalkan profit dari pergerakan besar
|
|
- Filter sinyal yang lebih ketat
|
|
- Fokus pada sesi trading yang aktif
|
|
*/
|
|
|
|
//==================== XAUUSD OPTIMIZED SETTINGS ====================
|
|
|
|
// Mode Trading - Swing untuk gold karena pergerakan besar
|
|
Mode = MODE_SWING
|
|
|
|
// Risk Management - Lebih konservatif untuk gold
|
|
AutoTrade = false // Set true untuk live trading
|
|
RiskPercent = 0.8 // Risiko lebih kecil karena volatilitas tinggi
|
|
Magic = 240813 // Magic number unik untuk XAUUSD
|
|
|
|
// Multi-Timeframe Scanner
|
|
EnableMTFScanner = true
|
|
PairsToScan = "XAUUSD" // Fokus hanya pada gold
|
|
MaxPairsToShow = 1
|
|
|
|
// Signal Validation - Filter lebih ketat untuk gold
|
|
EMA_Fast = 8
|
|
EMA_Slow = 21 // EMA lebih lambat untuk trend yang lebih jelas
|
|
RSI_Period = 14
|
|
RSI_Overbought = 75 // Filter ketat untuk menghindari false signal
|
|
RSI_Oversold = 25
|
|
ADX_Period = 14
|
|
ADX_MinStrength = 20 // ADX lebih rendah karena gold sering ranging
|
|
ATR_Period = 14
|
|
Stochastic_K = 14
|
|
Stochastic_D = 3
|
|
Stochastic_Slow = 3
|
|
MaxSpreadPoints = 800 // Spread filter lebih longgar untuk gold
|
|
|
|
// Supply & Demand Detection - Zone size disesuaikan untuk gold
|
|
EnableSDDetection = true
|
|
SD_Lookback = 200 // Lookback lebih panjang untuk gold
|
|
SD_MinTouch = 4 // Minimal 4 touches untuk validasi
|
|
SD_ZoneSize = 0.50 // Zone size 50 cents (USD)
|
|
SD_SupplyColor = clrRed
|
|
SD_DemandColor = clrGreen
|
|
|
|
// Smart TP/SL - Disesuaikan untuk volatilitas gold
|
|
UseATR_TP_SL = true
|
|
ATR_SL_Multiplier = 2.0 // SL lebih lebar karena volatilitas tinggi
|
|
ATR_TP_Multiplier = 3.0 // TP lebih besar untuk kompensasi spread
|
|
UseMultiTP = true
|
|
TP1_Ratio = 0.4 // TP1 lebih kecil untuk secure profit
|
|
TP2_Ratio = 0.4 // TP2 balance
|
|
TP3_Ratio = 0.2 // TP3 untuk profit maksimal
|
|
|
|
// Trailing & Lock Profit - Lebih lambat untuk gold
|
|
TrailStartPts = 200 // Trailing lebih lambat
|
|
TrailStepPts = 100 // Step lebih besar
|
|
LockStartPts = 150 // Lock profit lebih lambat
|
|
LockOffsetPts = 30 // Lock distance lebih jauh
|
|
|
|
// News Filter - Sangat penting untuk gold
|
|
NewsPauseEnable = true
|
|
UpcomingNewsTime = D'1970.01.01 00:00'
|
|
PauseBeforeMin = 30 // Pause lebih lama sebelum news
|
|
PauseAfterMin = 45 // Pause lebih lama setelah news
|
|
HighImpactNews = "NFP,CPI,GDP,Interest Rate,Employment,Geopolitical Events"
|
|
|
|
// Session Trading - Fokus pada sesi aktif
|
|
TradeStartHour = 7 // Mulai London session
|
|
TradeEndHour = 21 // Sampai akhir NY session
|
|
EnableSessionFilter = true
|
|
TradeAsia = false // Skip Asia (low liquidity untuk gold)
|
|
TradeLondon = true // London session penting untuk gold
|
|
TradeNewYork = true // NY session penting untuk gold
|
|
|
|
// Trendline Recognition
|
|
EnableTrendlines = true
|
|
TrendlineLookback = 100 // Lookback lebih panjang
|
|
TrendlineMinTouch = 3 // Minimal 3 touches
|
|
TrendlineColor = clrYellow
|
|
|
|
// Trade Journal
|
|
EnableTradeLog = true
|
|
LogFileName = "SmartBot_XAUUSD_Trades.csv"
|
|
|
|
// AI Assist - Disabled untuk gold (manual trading lebih aman)
|
|
AI_Assist_Enable = false
|
|
AI_Endpoint_URL = ""
|
|
AI_API_Key = ""
|
|
AI_TimeoutMs = 1200
|
|
AI_MaxChars = 600
|
|
AI_RequireApprove = false
|
|
|
|
//==================== XAUUSD TRADING STRATEGY ====================
|
|
|
|
/*
|
|
STRATEGI TRADING XAUUSD:
|
|
|
|
1. TREND FOLLOWING
|
|
- Gunakan EMA 8/21 untuk trend direction
|
|
- ADX > 20 untuk trend strength
|
|
- RSI 25-75 untuk momentum
|
|
|
|
2. ENTRY RULES
|
|
- BUY: EMA8 > EMA21, RSI < 75, ADX > 20
|
|
- SELL: EMA8 < EMA21, RSI > 25, ADX > 20
|
|
- Minimal 3 confirmations
|
|
|
|
3. EXIT RULES
|
|
- TP1: 40% dari total TP (secure profit)
|
|
- TP2: 40% dari total TP (balance)
|
|
- TP3: 20% dari total TP (max profit)
|
|
- Trailing stop setelah 200 points profit
|
|
|
|
4. RISK MANAGEMENT
|
|
- Max 0.8% risk per trade
|
|
- Spread filter 800 points
|
|
- News pause 30-45 menit
|
|
- Session filter aktif
|
|
|
|
5. SUPPLY & DEMAND
|
|
- Zone size 50 cents
|
|
- Minimal 4 touches
|
|
- Lookback 200 bars
|
|
*/
|
|
|
|
//==================== XAUUSD MARKET HOURS ====================
|
|
|
|
/*
|
|
OPTIMAL TRADING HOURS FOR XAUUSD:
|
|
|
|
London Session (07:00-16:00 GMT):
|
|
- High liquidity
|
|
- Major economic news
|
|
- Good for trend following
|
|
|
|
New York Session (13:00-22:00 GMT):
|
|
- Highest volatility
|
|
- Major US economic data
|
|
- Best for breakout trading
|
|
|
|
Avoid Asia Session (00:00-09:00 GMT):
|
|
- Low liquidity
|
|
- False breakouts common
|
|
- High spread
|
|
|
|
Best Trading Times:
|
|
- 07:00-16:00 GMT (London)
|
|
- 13:00-22:00 GMT (New York)
|
|
- Overlap: 13:00-16:00 GMT (Best)
|
|
*/
|
|
|
|
//==================== XAUUSD NEWS SENSITIVITY ====================
|
|
|
|
/*
|
|
HIGH IMPACT NEWS FOR XAUUSD:
|
|
|
|
Economic Data:
|
|
- NFP (Non-Farm Payrolls)
|
|
- CPI (Consumer Price Index)
|
|
- GDP (Gross Domestic Product)
|
|
- Interest Rate Decisions
|
|
- Employment Reports
|
|
|
|
Geopolitical Events:
|
|
- War/Conflict news
|
|
- Trade tensions
|
|
- Political instability
|
|
- Central bank announcements
|
|
|
|
News Trading Strategy:
|
|
- Pause trading 30 min before news
|
|
- Pause trading 45 min after news
|
|
- Monitor for breakout opportunities
|
|
- Use wider stops during news
|
|
*/
|
|
|
|
//==================== XAUUSD VOLATILITY ADAPTATION ====================
|
|
|
|
/*
|
|
VOLATILITY-BASED ADJUSTMENTS:
|
|
|
|
Low Volatility (< 100 USD daily range):
|
|
- Reduce ATR multipliers
|
|
- Tighter stops
|
|
- Smaller position sizes
|
|
|
|
Medium Volatility (100-200 USD daily range):
|
|
- Standard settings
|
|
- Normal position sizes
|
|
- Balanced risk/reward
|
|
|
|
High Volatility (> 200 USD daily range):
|
|
- Increase ATR multipliers
|
|
- Wider stops
|
|
- Smaller position sizes
|
|
- Focus on major support/resistance
|
|
*/
|
|
|
|
//==================== PERFORMANCE MONITORING ====================
|
|
|
|
/*
|
|
XAUUSD PERFORMANCE METRICS:
|
|
|
|
Target Performance:
|
|
- Win Rate: > 55%
|
|
- Profit Factor: > 1.8
|
|
- Max Drawdown: < 8%
|
|
- Average Win: > 150 USD
|
|
- Average Loss: < 80 USD
|
|
|
|
Monthly Targets:
|
|
- 15-25 trades per month
|
|
- 8-12 winning trades
|
|
- 3-5 losing trades
|
|
- Net Profit: > 500 USD
|
|
|
|
Risk Management:
|
|
- Never risk > 0.8% per trade
|
|
- Max 2 open positions
|
|
- Daily loss limit: 2%
|
|
- Weekly loss limit: 5%
|
|
*/
|
|
|
|
//==================== TROUBLESHOOTING XAUUSD ====================
|
|
|
|
/*
|
|
COMMON XAUUSD ISSUES:
|
|
|
|
1. High Spread Issues:
|
|
- Increase MaxSpreadPoints to 800-1000
|
|
- Trade only during active sessions
|
|
- Avoid news times
|
|
|
|
2. False Breakouts:
|
|
- Use longer EMA periods
|
|
- Increase confirmation count
|
|
- Wait for retest of levels
|
|
|
|
3. Whipsaw Losses:
|
|
- Increase ADX minimum to 25
|
|
- Use wider stops
|
|
- Focus on major trends only
|
|
|
|
4. News Gaps:
|
|
- Always use news filter
|
|
- Reduce position sizes
|
|
- Use wider stops during news
|
|
*/
|
|
|
|
//==================== BACKTESTING XAUUSD ====================
|
|
|
|
/*
|
|
BACKTESTING RECOMMENDATIONS:
|
|
|
|
Time Period:
|
|
- Minimum 6 months
|
|
- Include different market conditions
|
|
- Test during high/low volatility periods
|
|
|
|
Data Quality:
|
|
- Use tick data if possible
|
|
- Include spread costs
|
|
- Account for slippage
|
|
|
|
Optimization:
|
|
- Test different ATR multipliers
|
|
- Optimize session times
|
|
- Fine-tune risk parameters
|
|
|
|
Validation:
|
|
- Forward test for 1 month
|
|
- Compare with backtest results
|
|
- Monitor real-time performance
|
|
*/
|