OPEN-SOURCE SCRIPT
Adaptive SuperTrend -, Regime Filter & Buy/Sell Signals [LunqFX]

Adaptive SuperTrend is a self-tuning trend indicator for TradingView that fixes the biggest flaw of the classic SuperTrend: a fixed multiplier that whipsaws in choppy markets and lags in fast ones. This version makes the SuperTrend multiplier adaptive — it automatically widens in high volatility and tightens in low volatility — and layers a regime filter and a momentum filter on top to deliver clean, non-repainting Buy/Sell signals with an automatic take-profit / stop-loss ladder and live performance stats. It works on forex, crypto, stocks, indices, futures, gold (XAUUSD) and Bitcoin (BTCUSD), on any timeframe, for scalping, day trading and swing trading. Built in Pine Script v6. Keywords: adaptive supertrend, supertrend, trend, trend following, buy sell signals, regime filter, ATR trailing stop, volatility, momentum, take profit, stop loss, risk reward, trend reversal, no repaint, scalping, day trading, swing trading.
◆ WHY ADAPTIVE
A normal SuperTrend uses one fixed multiplier for every market and every condition, so it gets shaken out in volatile phases and reacts too slowly in calm ones. Adaptive SuperTrend ranks current volatility against its own recent history (0–100%) and maps that onto a multiplier range — wide when the market is wild, tight when it is calm — with zero manual tuning. The same settings behave sensibly on EURUSD, BTCUSD and the S&P 500.
◆ WHAT IT DOES
Adaptive trend line + fill — a volatility-adjusted trailing stop that flips turquoise (up) / magenta (down).
Filtered Buy/Sell signals — a trend flip only fires as a signal when two filters agree.
Auto TP/SL ladder — on every signal it draws the stop (on the trend line) and TP1 / TP2 / TP3 at 1R / 2R / 3R, so you get a complete trade plan instantly.
Conviction Score 0–100 — one number summarising how strong the current setup is.
Live win-rate stats — the script tracks its own past signals on the fly.
Neon trend candles + a clean live dashboard.
◆ HOW IT WORKS (the concepts)

Adaptive multiplier: ATR is ranked by percentile over a lookback window; the percentile sets the SuperTrend multiplier between your min and max.
SuperTrend core: the standard trailing-stop formula, flipping direction when price closes beyond the band.
Regime filter (Kaufman Efficiency Ratio): directional travel divided by total path = how trending vs choppy the market is. Signals are blocked in low-efficiency (range) conditions to cut false signals.
Momentum check: a flip is only taken when price is on the matching side of its momentum EMA.
Conviction Score: a weighted blend of trend efficiency, momentum agreement and trend-line slope (0–100).
Live stats: each signal is tracked sequentially — a “win” = price reaches TP1 (1R) before the stop — with no lookahead.
◆ HOW TO USE IT
Take BUY / SELL labels in the direction of the new trend; the SL and TP1/2/3 ladder give you the exact plan and risk/reward.
Favour signals with a high Conviction Score and a TRENDING regime; stand aside when the dashboard shows RANGE.
Manage the trade to TP1/TP2/TP3 or trail with the adaptive line.
Tune Min/Max multiplier for tighter or looser stops and Efficiency threshold for how strict the range filter is.
Combine with your own support/resistance, structure or higher-timeframe bias for confluence.
◆ SETTINGS
Adaptive Trend: ATR length, min/max multiplier, volatility window.
Regime Filter: on/off, efficiency length, trend threshold.
Momentum Check: on/off, momentum EMA.
Visuals: trend fill, glow, neon candles, Buy/Sell labels.
Trade Levels & Stats: auto TP/SL ladder, live signal stats.
Panel: show/hide, position, background, accent.
◆ ALERTS
Buy signal · Sell signal · Trend flip up · Trend flip down.
◆ ORIGINALITY
The SuperTrend trailing-stop formula is a standard, public technique, implemented here from scratch. The adaptive volatility-percentile multiplier, the regime filter integration, the Conviction Score, the R-based TP/SL ladder and the live win-rate engine are my own original work. No third-party or copied code is used.
◆ LIMITATIONS
This is a trend/volatility tool, not a complete system — always confirm with price action and risk management.
Like all trend-following tools, it can chop in tight ranges; the regime filter reduces but cannot eliminate this.
The fixed-R stop in the ladder is a planning aid (constant 1R), separate from the trailing adaptive line — they are different stops by design.
The live win-rate is the indicator’s own TP1-vs-stop estimate; if a single bar tags both the stop and TP1 it is counted as a win, so treat the stat as indicative, not exact.
Past performance and live stats do not guarantee future results.
◆ NON-REPAINTING
Trend, regime, signals and stats are computed from confirmed bar data with no security() lookahead. A signal printed on a closed bar stays. As with any live tool, the forming bar updates in real time and settles on close.
Adaptive SuperTrend is an educational analysis tool, not financial advice. Always do your own research and manage risk. © LunqFX.
◆ WHY ADAPTIVE
A normal SuperTrend uses one fixed multiplier for every market and every condition, so it gets shaken out in volatile phases and reacts too slowly in calm ones. Adaptive SuperTrend ranks current volatility against its own recent history (0–100%) and maps that onto a multiplier range — wide when the market is wild, tight when it is calm — with zero manual tuning. The same settings behave sensibly on EURUSD, BTCUSD and the S&P 500.
◆ WHAT IT DOES
Adaptive trend line + fill — a volatility-adjusted trailing stop that flips turquoise (up) / magenta (down).
Filtered Buy/Sell signals — a trend flip only fires as a signal when two filters agree.
Auto TP/SL ladder — on every signal it draws the stop (on the trend line) and TP1 / TP2 / TP3 at 1R / 2R / 3R, so you get a complete trade plan instantly.
Conviction Score 0–100 — one number summarising how strong the current setup is.
Live win-rate stats — the script tracks its own past signals on the fly.
Neon trend candles + a clean live dashboard.
◆ HOW IT WORKS (the concepts)
Adaptive multiplier: ATR is ranked by percentile over a lookback window; the percentile sets the SuperTrend multiplier between your min and max.
SuperTrend core: the standard trailing-stop formula, flipping direction when price closes beyond the band.
Regime filter (Kaufman Efficiency Ratio): directional travel divided by total path = how trending vs choppy the market is. Signals are blocked in low-efficiency (range) conditions to cut false signals.
Momentum check: a flip is only taken when price is on the matching side of its momentum EMA.
Conviction Score: a weighted blend of trend efficiency, momentum agreement and trend-line slope (0–100).
Live stats: each signal is tracked sequentially — a “win” = price reaches TP1 (1R) before the stop — with no lookahead.
◆ HOW TO USE IT
Take BUY / SELL labels in the direction of the new trend; the SL and TP1/2/3 ladder give you the exact plan and risk/reward.
Favour signals with a high Conviction Score and a TRENDING regime; stand aside when the dashboard shows RANGE.
Manage the trade to TP1/TP2/TP3 or trail with the adaptive line.
Tune Min/Max multiplier for tighter or looser stops and Efficiency threshold for how strict the range filter is.
Combine with your own support/resistance, structure or higher-timeframe bias for confluence.
◆ SETTINGS
Adaptive Trend: ATR length, min/max multiplier, volatility window.
Regime Filter: on/off, efficiency length, trend threshold.
Momentum Check: on/off, momentum EMA.
Visuals: trend fill, glow, neon candles, Buy/Sell labels.
Trade Levels & Stats: auto TP/SL ladder, live signal stats.
Panel: show/hide, position, background, accent.
◆ ALERTS
Buy signal · Sell signal · Trend flip up · Trend flip down.
◆ ORIGINALITY
The SuperTrend trailing-stop formula is a standard, public technique, implemented here from scratch. The adaptive volatility-percentile multiplier, the regime filter integration, the Conviction Score, the R-based TP/SL ladder and the live win-rate engine are my own original work. No third-party or copied code is used.
◆ LIMITATIONS
This is a trend/volatility tool, not a complete system — always confirm with price action and risk management.
Like all trend-following tools, it can chop in tight ranges; the regime filter reduces but cannot eliminate this.
The fixed-R stop in the ladder is a planning aid (constant 1R), separate from the trailing adaptive line — they are different stops by design.
The live win-rate is the indicator’s own TP1-vs-stop estimate; if a single bar tags both the stop and TP1 it is counted as a win, so treat the stat as indicative, not exact.
Past performance and live stats do not guarantee future results.
◆ NON-REPAINTING
Trend, regime, signals and stats are computed from confirmed bar data with no security() lookahead. A signal printed on a closed bar stays. As with any live tool, the forming bar updates in real time and settles on close.
Adaptive SuperTrend is an educational analysis tool, not financial advice. Always do your own research and manage risk. © LunqFX.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Trade setups with clear entry, stop, target and risk logic. Built for traders who want structure, not guessing.
💬 t.me/lunqfx
🌐 lunqfx.com
The same discipline, fully automated — NIGHT OWL:
🦉lunqfx.com/nightowl
💬 t.me/lunqfx
🌐 lunqfx.com
The same discipline, fully automated — NIGHT OWL:
🦉lunqfx.com/nightowl
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Trade setups with clear entry, stop, target and risk logic. Built for traders who want structure, not guessing.
💬 t.me/lunqfx
🌐 lunqfx.com
The same discipline, fully automated — NIGHT OWL:
🦉lunqfx.com/nightowl
💬 t.me/lunqfx
🌐 lunqfx.com
The same discipline, fully automated — NIGHT OWL:
🦉lunqfx.com/nightowl
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.