OPEN-SOURCE SCRIPT
Alpha Adaptive Supertrend [identityKa]

Alpha Adaptive Supertrend [identityKa]
A Supertrend that adjusts its own room for volatility.
The classic Supertrend uses a fixed ATR multiplier. That works when volatility is stable, but volatility is not stable: it compresses and expands in cycles. A multiplier that feels right in a quiet market is too tight in a violent one, and one that survives a violent market is too loose in a quiet one. This version lets the multiplier follow where volatility currently sits relative to its own history.
HOW IT WORKS
1. ATR percentile: the current ATR is ranked against its own last N bars (default 200) on a 0 to 100 scale. 0 means volatility is at the low end of its recent range, 100 means it is at the high end.
2. Adaptive multiplier: the multiplier moves linearly between two settings using that rank.
- Compressed volatility: tighter multiplier (default 2.0)
- Elevated volatility: wider multiplier (default 4.0)
- At the 50th percentile the multiplier is the midpoint (default 3.0, the classic value)
3. Supertrend logic: the bands are built from the source plus and minus multiplier x ATR. The lower band can only rise while the trend is bullish, the upper band can only fall while the trend is bearish. The trend flips when price closes through the active band.
Why the percentile matters: ATR already scales with volatility, so a Supertrend already gets wider in volatile markets. The adaptation adds a second-order response, tighter when the market is unusually quiet and wider when it is unusually wild, relative to that specific market's own behavior. Because it uses a percentile rank, the same defaults transfer across crypto, stocks, indices and FX without manual retuning.
WHAT YOU SEE
- Bullish line below price and bearish line above price, with a soft fill toward the source
- Small triangles on the bar where the trend flips
- Dashboard: Trend State, Trend Age, current trailing line level, distance to line (in ATR and %), volatility state with its percentile, and the multiplier currently in use
HOW TO USE IT
- Use the line as a trend-direction reference and as a volatility-aware reference level for your own risk planning.
- Trend Age helps you see how mature the current leg is.
- The volatility row tells you why the line is where it is: when it shows Elevated, the line intentionally gives price more room.
- Like any Supertrend, it works best when the market is trending. In sideways markets it can flip repeatedly. Pair it with a regime tool, for example Alpha Regime Dashboard, to know which environment you are in.
SETTINGS
- Calculation: source, ATR length, rank window, multipliers for compressed and elevated volatility
- Volatility Rules: percentile levels for the Compressed and Elevated labels
- Display: colors, fill, flip markers, bar coloring
- Dashboard: position, text size, footer
ALERTS
Trend flipped Bullish, flipped Bearish, flipped in either direction, volatility became Elevated, volatility became Compressed. For stable, non-repainting triggers, set the alert to Once Per Bar Close.
NOTES AND LIMITATIONS
- The line reacts to closed prices, so it is a lagging tool by design.
- The percentile needs history. In the first bars the multiplier uses the midpoint.
- Values on the current, unfinished bar can change until the bar closes.
This script is for educational and informational purposes only and is not financial advice. Past behavior does not guarantee future results.
Part of the Alpha Quant Toolkit by identityKa. See also: Alpha Regime Dashboard [identityKa], Alpha ER Regime Bands [identityKa].
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.