Williams %R + EMA Trend-Based DCA Strategy MT5 EA Overview This EA trades Gold on M1 using Williams %R signals and trend confirmation with EMA 200. If the initial trade goes into a floating loss, it applies a DCA (Dollar-Cost Averaging) system to recover. It limits risk with stop loss options, cooldowns, and daily max loss rules. General Parameters - Asset: XAUUSD (Gold) - Timeframe: 1 Minute - Leverage: 1:100 - Capital: $10,000 - Lot Size: 0.01 (Adjustable) - Trade Window (UTC+4): 11:00 Ð 16:00 (Adjustable & On/Off) - Max Daily Loss: $100 (Adjustable) - Cooldown After Max DCA Loss: 10 Minutes (Adjustable) Indicators - Williams %R Fast (Length: Period 9) Ñ Entry - Williams %R Slow (Length: Period 28) Ñ Entry - EMA 200 (Length: Ñ) Ñ Trend Filter - EMA 21 & 50 (Length: Ñ) Ñ TP & SL Conditions Trend Filter - Price above EMA 200 ? Only LONG trades - Price below EMA 200 ? Only SHORT trades Entry Rules Long Entry: * ¥ Price above EMA 200 * ¥ Williams %R (9) and (28) both between 0 and -25 Short Entry: * ¥ Price below EMA 200 * ¥ Williams %R (9) and (28) both between -100 and -75 Exit Rules Take Profit: * ¥ +3% profit of the current position size combining all open trades OR * ¥ EMA 21/50 cross (both TP conditions toggleable) Stop Loss: * ¥ SHORT: price > EMA 50 + 1 pip * ¥ LONG: price < EMA 50 - 1 pip DCA (Recovery Logic) DCA Trigger Condition: * ¥ A new DCA trade opens when floating loss of the previous position reaches 2% of the margin used on that position (adjustable) DCA Trigger Formula (with Leverage) Let: - Lot_Size = 0.01 - Leverage = 100 - Contract_Size = 100 oz (Gold) - Gold Price = Current Ask price (e.g., 2000) - Used_Margin = (Lot_Size ? Contract_Size ? Gold_Price) / Leverage Then: Trigger_Loss = Used_Margin ? DCA_Loss_Percent Example: Used_Margin = (0.01 ? 100 ? 2000) / 100 = $20 DCA Trigger at 2% loss ? 2% of $20 = $0.40 If floating loss ³ $0.40 ? Open another trade (same direction) DCA Scaling Parameters - Initial Lot Size: 0.01 - DCA Increase Factor: 1x - Increase Factor Step: Every 5 trades - After 8 trade do not increase the lot and use the same lot from 8th trade to future - Max DCA Trades: 10 - DCA Cooldown (after full loss close): 10 minutes DCA Exit Conditions * ¥ If cumulative DCA positions reach +3% profit (3% calculate combining all open trades lots and when reach 3% of the trade size close all trades ) OR * ¥ EMA 21/50 cross * Close only if overall open trades in profit Fail-Safe Exit * ¥ If max DCA trades reached with no recovery ? * - Close all positions * - Record the loss * - Start cooldown * - Stop for the day if max loss hit Daily Protection ¥ Stop trading if daily floating or closed losses ³ $100 (adjustable)