Goldusd
- Utilità
- Osama Benalhadi
- Versione: 1.0
- Attivazioni: 10
Key Fixes Applied
-
Added #include <Trade/Trade.mqh> → Required for CTrade class.
-
Initialized CTrade trade → Needed to execute trades.
-
Fixed array handling for EMA values → Used CopyBuffer() correctly.
-
Normalized SL/TP prices → Used NormalizeDouble() to avoid "invalid stops" errors.
-
Corrected price checks → Used iHigh() & iLow() for previous candle.
-
Adjusted point values → Changed TP/SL to points (1 pip = 10 points in 5-digit brokers).
How to Test This EA
-
Compile in MetaEditor (F7) → Ensure no errors.
-
Backtest in MT5 (Strategy Tester) → Check performance on XAU/USD (Gold).
-
Optimize parameters → Adjust EMA periods, SL/TP levels.
-
Run on Demo Account → Forward-test for stability
