King of Gold Ucb Agent
- Experts
- Version: 1.18
- Updated: 27 September 2026
- Activations: 7
King of Gold – Adaptive Bandit Expert Advisor
King of Gold is a self-learning Expert Advisor built for XAUUSD. It can also be attached to crypto, index, stock or forex charts. It doesn't follow one fixed rule set. It uses several contextual multi-armed bandits (UCB) that learn from every closed trade which entries, sizing and execution work best in each market context, and it keeps adjusting as conditions change.
The EA trades the symbol and timeframe of the chart it is attached to.
How it works
- Setup detection. It watches streaks of consecutive bullish and bearish bars. The EA learns by itself whether a streak tends to reverse or continue, and how long the streak must be, separately for each trading session and market regime.
- Decision bandit (UCB). For every signal it chooses SKIP, SMALL, NORMAL or STRONG position size, depending on the context: session, regime, signal score and liquidity zone.
- Execution bandit. It chooses between a market order and a limit order placed at a volume-profile liquidity zone.
- Profile bandit. It chooses a short-term, normal or long-term TP/SL profile.
- Additional bandits for timeframe alignment (M1–H4), candle patterns and multi-timeframe confluence.
- Consistent reward scale. Every outcome is measured in R, where 1R is the risk of one base-sized trade. The learning therefore sees both win rate and the size of each win or loss.
- Persistent memory. Everything learned is saved to a file and restored after a restart.
Risk and trade management
- Fixed lot or risk-% position sizing
- Stop Loss and Take Profit on every trade
- Basket auto-close at a profit target, with optional trailing close
- Daily profit target and daily loss limit, with optional trailing giveback protection
- Optional trailing stop, breakeven and adaptive stop loss. These stay active outside trading hours.
- Recovery mode, safe mode for small balances, and a cooldown after losses
- Trading hours, trading days and spread filter
- Order-flow protection: closes a profitable basket when incoming volume turns strongly against it
Market context
- Volume-profile liquidity zones
- Order book (DOM) signals on brokers that provide market depth, with automatic fallback to volume profile otherwise
- Economic calendar awareness: upcoming high-impact news and released-news bias
- London / New York session performance tracking
Alerts
- Telegram notifications for entries, closes, risk events, news and sessions
- Optional sound alerts
- On-chart status panel and periodic learning telemetry in the Journal
What's new in 1.18
- Learning rewards are no longer truncated, so the bandits see the real size of every win and loss
- Position-size decisions now apply in fixed-lot mode too
- Fairer evaluation of skipped trades
- Corrected bearish candle scoring and multi-timeframe confluence
- Improved performance: indicator handles are cached and the analysis runs once per bar
- Full compliance with MQL5 trading checks: freeze level, stops level, volume and margin
- Positions are closed reliably during daily loss / close-all events
- Telegram emoji display fixed
Recommendations
- An ECN / raw-spread account is recommended for XAUUSD.
- Start on a demo account and let the EA build its learning history before trading live.
- Test the settings in the Strategy Tester on your broker's data.
Risk warning
Trading gold, CFDs, cryptocurrencies, indices and stocks carries a high level of risk and may not be suitable for all investors. You may lose more than your initial deposit. Past performance, including backtests, does not guarantee future results. The EA learns from past trades and cannot predict the market. Always use proper risk management.
Support
Please use the MQL5 comments section or MQL5 private messages for support.

This EA is incredible, stable and profitable. The developer is very friendly and responsive, always ready to help with setup. I recommend this bot without hesitation