Indicator · Pine Script v5 · On the chart

Multi Supertrend [Alorse]

by Alorse

This indicator calculates the Supertrend direction across multiple selected symbols on the active timeframe using custom ATR length and multiplier settings.

View on GitHub

GitHub stars330on the repository
Pine versionv5runs as is
Lines of code261
Settings40inputs
LicenceNone statedfile: MPL-2.0
Last update2 months ago25 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

261 lines of Pine Script v5 from multi/Multi Supertrend.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Multi Supertrend.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alorse

//@version=5
indicator("Multi Supertrend [Alorse]", overlay=true)

atrPeriod = input.int(10, "ATR Length")
factor = input.float(3.0, "Factor", step = 0.01)

pine_rma(src, length) =>
    alpha = 1/length
    sum = 0.0
    sum := na(sum[1]) ? ta.sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])

//the same on pine
pine_atr(length, hi, lo, cl) =>
    trueRange = na(hi[1])? hi-lo : math.max(math.max(hi - lo, math.abs(hi - cl[1])), math.abs(lo - cl[1]))
    //true range can be also calculated with ta.tr(true)
    //ta.rma(trueRange, length)
    pine_rma(trueRange, length)

// Timeframe
timeframeSetUp(number) =>
    switch number
        '60' => '1H'
        '120' => '2h'
        '180' => '3H'
        '240' => '4H'
        'D' => '1D'
        => number + ' minutes'

screenerFunc(_ticker, atrP, fac) =>
    [cl, hl, lo, hi] = request.security(_ticker, timeframe.period, [close, hl2, low, high])
    // atr = ta.atr(atrP)
    atr = pine_atr(atrP, hi, lo, cl)
    up = hl - fac * atr
    up1 = nz(up[1], up)
    up := cl[1] > up1 ? math.max(up, up1) : up
    dn = hl + fac * atr
    dn1 = nz(dn[1], dn)
    dn := cl[1] < dn1 ? math.min(dn, dn1) : dn
    trend = 1
    trend := nz(trend[1], trend)
    trend := trend == -1 and cl > dn1 ? 1 : trend == 1 and cl < up1 ? -1 : trend

    inHours = timeframeSetUp(timeframe.period)
    cleanTicker = str.replace_all(_ticker, 'BINGBON:', '')

    if trend == 1 and trend[1] == -1
        alert('{"text": "🟢 BUY IN ' + cleanTicker + ' - ' + inHours + '"}', alert.freq_once_per_bar_close)
        if syminfo.tickerid == _ticker
            label.new(bar_index, lo, "Buy", color=color.green, style=label.style_label_up, textcolor=color.white, size=size.small)
    if trend == -1 and trend[1] == 1
        alert('{"text": "🔴 SELL IN ' + cleanTicker + ' - ' + inHours + '"}', alert.freq_once_per_bar_close)
        if syminfo.tickerid == _ticker
            label.new(bar_index, hi, "Sell", color=color.red, style=label.style_label_down, textcolor=color.white, size=size.small)
    

// Symbols 
// There is a limit of 40 security calls so only 40 symbols at the same time is possible

e01 = input.bool(title='', defval=true, group='Symbol 1', inline='s01')
s01 = input.symbol('BTCUSDT', title='', group='Symbol 1', inline='s01')

e02 = input.bool(title='', defval=true, group='Symbol 2', inline='s02')
s02 = input.symbol('ETHUSDT', title='', group='Symbol 2', inline='s02')

e03 = input.bool(title='', defval=true, group='Symbol 3', inline='s03')
s03 = input.symbol('BNBUSDT', title='', group='Symbol 3', inline='s03')

e04 = input.bool(title='', defval=true, group='Symbol 4', inline='s04')
s04 = input.symbol('ADAUSDT', title='', group='Symbol 4', inline='s04')

e05 = input.bool(title='', defval=true, group='Symbol 5', inline='s05')
s05 = input.symbol('XRPUSDT', title='', group='Symbol 5', inline='s05')

e06 = input.bool(title='', defval=true, group='Symbol 6', inline='s06')
s06 = input.symbol('SOLUSDT', title='', group='Symbol 6', inline='s06')

e07 = input.bool(title='', defval=true, group='Symbol 7', inline='s07')
s07 = input.symbol('DOTUSDT', title='', group='Symbol 7', inline='s07')

e08 = input.bool(title='', defval=true, group='Symbol 8', inline='s08')
s08 = input.symbol('DOGEUSDT', title='', group='Symbol 8', inline='s08')

e09 = input.bool(title='', defval=true, group='Symbol 9', inline='s09')
s09 = input.symbol('UNIUSDT', title='', group='Symbol 9', inline='s09')

e10 = input.bool(title='', defval=true, group='Symbol 10', inline='s10')
s10 = input.symbol('LUNAUSDT', title='', group='Symbol 10', inline='s10')

e11 = input.bool(title='', defval=true, group='Symbol 11', inline='s11')
s11 = input.symbol('AVAXUSDT', title='', group='Symbol 11', inline='s11')

e12 = input.bool(title='', defval=true, group='Symbol 12', inline='s12')
s12 = input.symbol('LTCUSDT', title='', group='Symbol 12', inline='s12')

e13 = input.bool(title='', defval=true, group='Symbol 13', inline='s13')
s13 = input.symbol('SHIBUSDT', title='', group='Symbol 13', inline='s13')

e14 = input.bool(title='', defval=true, group='Symbol 14', inline='s14')
s14 = input.symbol('LINKUSDT', title='', group='Symbol 14', inline='s14')

e15 = input.bool(title='', defval=true, group='Symbol 15', inline='s15')
s15 = input.symbol('BCHUSDT', title='', group='Symbol 15', inline='s15')

e16 = input.bool(title='', defval=true, group='Symbol 16', inline='s16')
s16 = input.symbol('ALGOUSDT', title='', group='Symbol 16', inline='s16')

e17 = input.bool(title='', defval=true, group='Symbol 17', inline='s17')
s17 = input.symbol('XLMUSDT', title='', group='Symbol 17', inline='s17')

e18 = input.bool(title='', defval=true, group='Symbol 18', inline='s18')
s18 = input.symbol('MATICUSDT', title='', group='Symbol 18', inline='s18')

e19 = input.bool(title='', defval=true, group='Symbol 19', inline='s19')
s19 = input.symbol('AXSUSDT', title='', group='Symbol 19', inline='s19')

e20 = input.bool(title='', defval=true, group='Symbol 20', inline='s20')
s20 = input.symbol('FILUSDT', title='', group='Symbol 20', inline='s20')

e21 = input.bool(title='', defval=true, group='Symbol 21', inline='s21')
s21 = input.symbol('ATOMUSDT', title='', group='Symbol 21', inline='s21')

e22 = input.bool(title='', defval=true, group='Symbol 22', inline='s22')
s22 = input.symbol('VETUSDT', title='', group='Symbol 22', inline='s22')

e23 = input.bool(title='', defval=true, group='Symbol 23', inline='s23')
s23 = input.symbol('ICPUSDT', title='', group='Symbol 23', inline='s23')

e24 = input.bool(title='', defval=true, group='Symbol 24', inline='s24')
s24 = input.symbol('TRXUSDT', title='', group='Symbol 24', inline='s24')

e25 = input.bool(title='', defval=true, group='Symbol 25', inline='s25')
s25 = input.symbol('ETCUSDT', title='', group='Symbol 25', inline='s25')

e26 = input.bool(title='', defval=true, group='Symbol 26', inline='s26')
s26 = input.symbol('XTZUSDT', title='', group='Symbol 26', inline='s26')

e27 = input.bool(title='', defval=true, group='Symbol 27', inline='s27')
s27 = input.symbol('THETAUSDT', title='', group='Symbol 27', inline='s27')

e28 = input.bool(title='', defval=true, group='Symbol 28', inline='s28')
s28 = input.symbol('HBARUSDT', title='', group='Symbol 28', inline='s28')

e29 = input.bool(title='', defval=true, group='Symbol 29', inline='s29')
s29 = input.symbol('FTMUSDT', title='', group='Symbol 29', inline='s29')

e30 = input.bool(title='', defval=true, group='Symbol 30', inline='s30')
s30 = input.symbol('XMRUSDT', title='', group='Symbol 30', inline='s30')

e31 = input.bool(title='', defval=true, group='Symbol 31', inline='s31')
s31 = input.symbol('EGLDUSDT', title='', group='Symbol 31', inline='s31')

e32 = input.bool(title='', defval=true, group='Symbol 32', inline='s32')
s32 = input.symbol('EOSUSDT', title='', group='Symbol 32', inline='s32')

e33 = input.bool(title='', defval=true, group='Symbol 33', inline='s33')
s33 = input.symbol('KLAYUSDT', title='', group='Symbol 33', inline='s33')

e34 = input.bool(title='', defval=true, group='Symbol 34', inline='s34')
s34 = input.symbol('AAVEUSDT', title='', group='Symbol 34', inline='s34')

e35 = input.bool(title='', defval=true, group='Symbol 35', inline='s35')
s35 = input.symbol('IOTAUSDT', title='', group='Symbol 35', inline='s35')

e36 = input.bool(title='', defval=true, group='Symbol 36', inline='s36')
s36 = input.symbol('NEARUSDT', title='', group='Symbol 36', inline='s36')

e37 = input.bool(title='', defval=true, group='Symbol 37', inline='s37')
s37 = input.symbol('WAVESUSDT', title='', group='Symbol 37', inline='s37')

e38 = input.bool(title='', defval=true, group='Symbol 38', inline='s38')
s38 = input.symbol('GRTUSDT', title='', group='Symbol 38', inline='s38')

e39 = input.bool(title='', defval=true, group='Symbol 39', inline='s39')
s39 = input.symbol('NEOUSDT', title='', group='Symbol 39', inline='s39')

e40 = input.bool(title='', defval=true, group='Symbol 40', inline='s40')
s40 = input.symbol('KSMUSDT', title='', group='Symbol 40', inline='s40')

if e01
    screenerFunc(s01, atrPeriod, factor)
if e02
    screenerFunc(s02, atrPeriod, factor)
if e03
    screenerFunc(s03, atrPeriod, factor)
if e04
    screenerFunc(s04, atrPeriod, factor)
if e05
    screenerFunc(s05, atrPeriod, factor)
if e06
    screenerFunc(s06, atrPeriod, factor)
if e07
    screenerFunc(s07, atrPeriod, factor)
if e08
    screenerFunc(s08, atrPeriod, factor)
if e09
    screenerFunc(s09, atrPeriod, factor)
if e10
    screenerFunc(s10, atrPeriod, factor)
if e11
    screenerFunc(s11, atrPeriod, factor)
if e12
    screenerFunc(s12, atrPeriod, factor)
if e13
    screenerFunc(s13, atrPeriod, factor)
if e14
    screenerFunc(s14, atrPeriod, factor)
if e15
    screenerFunc(s15, atrPeriod, factor)
if e16
    screenerFunc(s16, atrPeriod, factor)
if e17
    screenerFunc(s17, atrPeriod, factor)
if e18
    screenerFunc(s18, atrPeriod, factor)
if e19
    screenerFunc(s19, atrPeriod, factor)
if e20
    screenerFunc(s20, atrPeriod, factor)
if e21
    screenerFunc(s21, atrPeriod, factor)
if e22
    screenerFunc(s22, atrPeriod, factor)
if e23
    screenerFunc(s23, atrPeriod, factor)
if e24
    screenerFunc(s24, atrPeriod, factor)
if e25
    screenerFunc(s25, atrPeriod, factor)
if e26
    screenerFunc(s26, atrPeriod, factor)
if e27
    screenerFunc(s27, atrPeriod, factor)
if e28
    screenerFunc(s28, atrPeriod, factor)
if e29
    screenerFunc(s29, atrPeriod, factor)
if e30
    screenerFunc(s30, atrPeriod, factor)
if e31
    screenerFunc(s31, atrPeriod, factor)
if e32
    screenerFunc(s32, atrPeriod, factor)
if e33
    screenerFunc(s33, atrPeriod, factor)
if e34
    screenerFunc(s34, atrPeriod, factor)
if e35
    screenerFunc(s35, atrPeriod, factor)
if e36
    screenerFunc(s36, atrPeriod, factor)
if e37
    screenerFunc(s37, atrPeriod, factor)
if e38
    screenerFunc(s38, atrPeriod, factor)
if e39
    screenerFunc(s39, atrPeriod, factor)
if e40
    screenerFunc(s40, atrPeriod, factor)

Overview

When the trend switches between bullish and bearish for any enabled asset, the script triggers formatted JSON alert messages containing the trade action, ticker, and timeframe. If the active chart matches a monitored symbol, it draws Buy or Sell labels directly on price bars upon bar close. Users can configure ATR parameters and enable or select different asset tickers.

Details

Published by

Alorse on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinescriptpinescript-indicatorspinescript-strategiestrading-strategiestradingviewtradingview-alerttradingview-strategy

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
ATR Lengthint10atrPeriod
Factorfloat3.0factor
e01booltruee01
s01symbolBTCUSDTs01
e02booltruee02
s02symbolETHUSDTs02
e03booltruee03
s03symbolBNBUSDTs03
e04booltruee04
s04symbolADAUSDTs04
e05booltruee05
s05symbolXRPUSDTs05
Show all 40 settings
SettingTypeDefaultVariable
e06booltruee06
s06symbolSOLUSDTs06
e07booltruee07
s07symbolDOTUSDTs07
e08booltruee08
s08symbolDOGEUSDTs08
e09booltruee09
s09symbolUNIUSDTs09
e10booltruee10
s10symbolLUNAUSDTs10
e11booltruee11
s11symbolAVAXUSDTs11
e12booltruee12
s12symbolLTCUSDTs12
e13booltruee13
s13symbolSHIBUSDTs13
e14booltruee14
s14symbolLINKUSDTs14
e15booltruee15
s15symbolBCHUSDTs15
e16booltruee16
s16symbolALGOUSDTs16
e17booltruee17
s17symbolXLMUSDTs17
e18booltruee18
s18symbolMATICUSDTs18
e19booltruee19
s19symbolAXSUSDTs19
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec

Indicator v4 TrendMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive Laguerre Filter
575 stars

This indicator detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult

Indicator v5 Support & resistanceTrend
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows with Screener
318 stars

This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos

Indicator v5 TrendVolatility & bands
Updated 2 months ago · MIT GitHub repository of ATR Trailing Stoploss

All Candlestick Patterns

by shunjizhan
292 stars

All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an

Indicator v4 Candlestick patternsTrend
Updated 3 years ago · None stated GitHub repository of All Candlestick Patterns

NVDA Trend Ribbon

by longsurf-ai
277 stars

This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre

Indicator v6 TrendMoving averages
Updated yesterday · MIT GitHub repository of NVDA Trend Ribbon

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers