Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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 + ' minutos'
- 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": "🟢 COMPRA EN ' + 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": "🔴 VENTA EN ' + 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement