Queen of Gold Ucb Agents
- Experts
- Version: 1.0
- Activations: 15
Queen of Gold Ucb Agents
is an adaptive MQL5 agents EA that use bandit agents.
How It Operates:
- the agents will make a .dat file for every simbol they trade
- the agents whill make self strategy on entry en exit.
- every decision is save to data file so next time the agent will pick the right arm
- the agents are made in MQL5 programing language en also all internal librarys MQL5 programing ,no external dependicy imports !!
- The Queen is not made for Bactesting results , on MQL5 vps to test nonstop,use the exemple set files en don't play whit the settings!!!
- if you need help just contact me in mql5 chat!!
That raw setup is then evaluated through a broader market-context model. The EA measures:
- spread conditions
- volume quality
- tick-flow and burst behavior
- liquidity distance / smart-entry potential
- session timing
- reward regime and market regime
- account health and low-balance constraints
These features are encoded into a contextual key. That key is the state representation used by the UCB bandit.
Bandit Decision Layer
For each context, the bandit estimates the value of several actions:
- HOLD
- BUY_MARKET
- SELL_MARKET
- LIMIT_FOLLOW_SIGNAL
The UCB mechanism balances two things:
- exploitation: repeat actions that historically performed well in similar contexts
- exploration: still test less-used actions when confidence is low
This means the EA does not blindly execute every detected setup. It can:
- allow the trade
- deny the trade
- prefer market execution
- prefer limit execution when precision entry is statistically better
Over time, the model becomes more selective and context-aware.
Learning Process
When a position closes, the EA computes a normalized reward from the result. That reward is not based only on raw profit. It also considers:
- profit relative to estimated risk
- adverse excursion
- hold duration
- entry type
- contextual microstructure quality
The reward is then written back into the UCB memory for the specific context and chosen arm. This updates:
- pull count
- cumulative reward
- decayed mean reward
As a result, the EA continuously refines which actions are best for specific trading conditions.
Persistence and Recovery
The system is designed to retain learning between restarts.
- UseUcbFilePersistence stores learned UCB state locally
- on initialization, the EA reloads that state automatically
- if no learned state exists, UseUcbWarmupFromHistory seeds the model from historical closed trades
- UseUcbJsonSnapshot produces a readable JSON snapshot of the learned state for inspection and diagnostics
This gives the EA both continuity and recoverability. It does not need to relearn from zero every time it is restarted.
Risk and Execution Controls
The bandit layer sits inside a broader execution framework with practical safeguards:
- max open trades control
- low-balance protection
- optional cooldown after losses
- spread and volume toxicity filters
- optional DOM-based confirmation
- adaptive smart-entry behavior
- market vs limit execution handling
- basket management and auto-close logic
So the EA is not only predictive, but operationally defensive.
Professional Summary
This EA is best understood as a hybrid adaptive execution system:
- deterministic rules generate candidate trade opportunities
- contextual UCB decides whether and how to act
- trade outcomes are transformed into learning signals
- learned behavior is persisted and reused across sessions
In professional terms, it is a self-updating decision framework intended to improve trade selectivity, execution choice, and contextual consistency over time rather than rely on a fixed static strategy.
