This is a next-generation SuperTrend indicator that layers a full machine learning engine on top of the classic trend-following concept. Rather than using fixed ATR multipliers and static rules, the indicator continuously learns from its own signal history, adapts its core parameters bar by bar, and filters entries through a multi-stage confirmation pipeline before plotting any arrow on the chart. It runs entirely inside the MetaTrader 5 indicator framework, requires no external libraries, and exposes a hidden Confidence buffer that any Expert Advisor can read directly for automated trading.
The indicator is organized into 13 input groups covering every aspect of its behavior: signal mode, volatility envelope, momentum filter, flow analysis, signal quality, the master reactivity dial, the auto-tune engine, the optimizer, risk guard, context memory (regime grid), decay traces, alerts, and display. Default values have been chosen so that the indicator works out of the box on any liquid symbol and any timeframe, but every parameter can be adjusted independently to suit a specific instrument or trading style.
How the Indicator Works
At its core the indicator computes two SuperTrend bands β a Bull line (blue) and a Bear line (red) β using an RMA-smoothed ATR envelope applied to a user-selected price basis. The band width and ATR period are not fixed: they start from the values you enter and are then continuously adjusted by the optimizer each time new trade outcomes are evaluated. This means the envelope naturally widens during high-volatility regimes and tightens during calm markets without any manual intervention.
Signals are generated in one of two modes. In Reversal mode the indicator watches for a confirmed trend flip: a bullish pivot must form while the trend is bearish (producing a green buy arrow), or a bearish pivot must form while the trend is bullish (producing a red sell arrow). In Breakout mode the logic is inverted: a new swing high during an uptrend triggers a sell signal anticipating a failed breakout, and a new swing low during a downtrend triggers a buy signal. Both modes require all active confirmation filters to agree before any arrow is drawn.
Confirmation Filters
Every candidate signal passes through three independent filters before it is accepted.
The Momentum Filter uses a standard RSI. For a buy signal to fire, RSI must have touched or crossed below the Cold Level (default 30) within the recent lookback window. For a sell signal, RSI must have touched or crossed above the Hot Level (default 70). This prevents the indicator from generating counter-trend entries during one-sided momentum runs.
The Flow Analysis filter examines tick volume. When the Require Surge option is enabled, a signal is only accepted if the current bar's volume exceeds the average of the preceding sample bars by at least the Surge Threshold factor. This eliminates signals that occur on low-activity bars where breakouts are more likely to be false.
The Signal Quality filter, when Key Levels Only mode is active, requires that the pivot behind the signal is a major structural level: the distance from the swing high to the nearest swing low (or vice versa) must exceed the Key Level Depth multiplied by the current ATR. This keeps signals anchored to significant price structure rather than minor wiggles.
Machine Learning Engine
The ML engine operates through four cooperating subsystems.
The Context Memory (Regime Grid) is an 8x8 grid (configurable) that maps market regime on one axis and volatility on the other. Each cell accumulates exponentially weighted statistics from past trades that occurred under similar conditions. When a new signal is being evaluated, the indicator reads the cell corresponding to the current regime and volatility, blends its recommendations across neighboring cells using a Gaussian kernel (controlled by the Neighbor Blend Radius), and adjusts the confidence score accordingly. Cells decay over time via a half-life parameter so that stale market memory is gradually forgotten.
The Optimizer runs every few bars (set by Update Cooldown). It evaluates a rolling window of recent trade outcomes and computes gradient-style updates for five parameters: band width multiplier, ATR smoothing length, stop distance, take-profit distance, and breakout buffer. Updates are quantized to avoid noise-chasing, and a deadband prevents micro-adjustments that do not meaningfully change behavior. A periodic revert step pulls parameters back toward their anchor values to prevent drift during unusual market conditions.
The Decay Trace Buffer stores a short-term memory of recent signal outcomes as decaying energy records. Each record holds the ATR-normalized return, maximum adverse excursion, regime state, and volatility level at the time of the signal. These traces feed the optimizer with richer context than simple win/loss counts, helping it distinguish between signals that were directionally correct but stopped out by noise versus those that were genuinely wrong.
The Micro-Batch Processor, when enabled, groups recent outcomes into small batches and computes batch-level parameter recommendations. These batch signals are blended with the optimizer's rolling recommendations to smooth out single-trade overreactions.
Risk Guard
The Risk Guard system sits between the signal engine and the buffer writer. Even if all confirmation filters pass and the ML engine endorses a signal, the Risk Guard can block it under the following conditions.
- Session trade limit. Once the number of signals in the current trading day reaches Max Entries Per Session, no further signals are plotted for the rest of that day.
- Session loss limit. If the simulated session PnL (computed from the Sim Position USD and ATR-based stop distances) drops below the Session Loss Limit, all further signals are blocked until the next session.
- Cooldown after loss. After a losing trade the indicator imposes a pause of at least Base Pause After Loss bars. If Dynamic Cooldown is enabled the pause scales with the size of the loss relative to ATR, so larger losses produce longer pauses.
- Consecutive loss streak. If the number of consecutive losses reaches the Streak Limit, trading is paused for the remainder of the session regardless of the cooldown timer.
All Risk Guard counters reset automatically at the start of each new trading day.
Confidence Score and EA Integration
Every signal bar receives a Confidence Score between 0 and 100, written to the hidden fifth buffer (label: Confidence). The score is built from four components: the grid cell confidence from the Regime Grid, a boost when RSI is strongly confirming the signal direction, a boost when a volume surge is present, and a boost when the current regime aligns with the signal direction. An Expert Advisor can read this buffer using CopyBuffer and use the score to scale position size, filter low-confidence signals, or rank competing signals across multiple symbols.
Dashboard
When Show Info Dashboard is enabled, a multi-column table is drawn directly on the chart as a text label object. The dashboard displays the current trend direction, real win rates for long and short signals separately (computed from actual 5-bar forward price comparison rather than simulation), Sharpe and Sortino ratios from the rolling ATR-return history, total signal counts, the current confidence score, and Risk Guard status (active cooldown bars remaining, trades used in the session, session PnL). The dashboard updates on every new bar and on every real-time tick.
Alerts
The indicator can send a MetaTrader popup alert and/or a mobile push notification whenever a new buy or sell arrow is drawn on the current (live) bar. The Alert Once per Bar option prevents duplicate alerts when the indicator recalculates on the same bar due to new ticks.
Input Parameters
Note: This indicator is provided for educational and analytical purposes. The machine learning subsystems adapt to historical price data and do not guarantee future performance. Always validate on a demo account before using in live trading. Simulated PnL figures shown on the dashboard are based on ATR-scaled assumptions and do not reflect actual broker execution conditions.