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].
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.