Demo Indicator: AI Waves [Nexo Mechanics]This is a demo indicator that uses an AI selection model to choose between multiple moving-average "waves". It uses a UCB (Upper Confidence Bound) bandit model to dynamically choose between multiple moving-average “waves” and displays the selection plus basic learning metrics.
At a high level, the model treats each wave as an option and keeps a running score for each one based on how it performed recently. It will usually stick with waves that have been doing well, but it will also occasionally try other waves so it doesn’t get stuck on something that stopped working.
How the Model Learns
When the model makes a prediction, it waits X bars (Prediction Horizon), then checks whether price moved in the predicted direction. If it did, that wave’s Avg Reward increases; if not, it decreases.
Scoring Method
For each wave, the model takes its Avg Reward and adds an exploration bonus that gets bigger when that wave hasn’t been used much yet. Conceptually: Score = Avg Reward + (Exploration Bonus). The exploration bonus grows with the Level of Exploration and shrinks as Uses increases, so the model will mostly follow the best-performing waves, but still occasionally test less-used ones to see if they’ve improved.
Metrics Table Definitions
Uses: how many predictions were made using that wave
Avg Reward: how well that wave has worked recently (higher is better)
Score: what the model uses internally to decide which wave to pick next (includes exploration)
Notes
This is intentionally lightweight and heuristic-based (not a deep learning model). It’s meant to show a practical way to use AI in Pine Script using a UCB approach.
Not financial advice.
Chỉ báo Pine Script®






















