TradingView
atomicbear96
1 Mar 2023 pukul 05.48

MultyTimeframe 

Ethereum Classic / KRWUpBit

Deskripsi

Library "MultyTimeframe"
TODO: add library description here

MultTimeframes()

Catatan Rilis

v2 Timeframe seconds added
Komentar
Omni-Trading
What is the best example for this lib? Can it be used for dynamic length?
atomicbear96
@OmniTekTrading,
Thank you
The indicators in the chart are raised incorrectly and are not library related. Sorry for the confusion.
This library is published to create a variety of multi-timeframe indicators. For example,
EMAs of upper timeframes or Bollinger Bands.
atomicbear96
@atomicbear96,
//@version=5
indicator("[Sample]Multy timeframe SMMA & Bollinger Band", overlay = true)

// import Timeframes
import atomicbear96/MultyTimeframe/1 as MultyTimeframe
[big_interval, big_interval_2, big_mult, big_mult_2] = MultyTimeframe.MultTimeframes()

// Safe Security
nonRepaintingSecurity(sym, tf, src) =>
request.security(sym, tf, src[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1]

// Set colors at timeframe
t_color = color.new(color.navy,10)
t_color_big = color.new(color.navy,50)
t_color_big_2 = color.new(color.navy,80)

// 1. EMA Multy timeframe
ema = ta.sma(close, 20)
ema_big = nonRepaintingSecurity(syminfo.tickerid, big_interval, ema)
ema_big_2 = nonRepaintingSecurity(syminfo.tickerid, big_interval_2, ema)
// draw
plot(ema, color = t_color)
plot(ema_big, color = t_color_big)
plot(ema_big_2, color = t_color_big_2)
atomicbear96
@atomicbear96,
// 2. Bollinger Band Multy timeframe
bb_len = input.int(20, "BB len", group = "Bollinger Band")
bb_mult = input.float(2, "BB mult", group = "Bollinger Band")
// bb
[bb_mid, bb_top, bb_bot] = ta.bb(close, bb_len, bb_mult)
// Timeframe BB Calc
f_bb(src, length, mult, _interval) =>
float basis = nonRepaintingSecurity(syminfo.tickerid, _interval,ta.sma(src, length))
float dev = nonRepaintingSecurity(syminfo.tickerid, _interval,mult * ta.stdev(src, length))
[basis, basis + dev, basis - dev]
[bb_mid_big, bb_top_big, bb_bot_big] = f_bb(close, bb_len, bb_mult, big_interval)
[bb_mid_big_2, bb_top_big_2, bb_bot_big_2] = f_bb(close, bb_len, bb_mult, big_interval_2)
// draw
plot(bb_mid, color = t_color)
plot(bb_top, color = t_color)
plot(bb_bot, color = t_color)
plot(bb_mid_big, color = t_color_big)
plot(bb_top_big, color = t_color_big)
plot(bb_bot_big, color = t_color_big)
plot(bb_mid_big_2, color = t_color_big_2)
plot(bb_top_big_2, color = t_color_big_2)
plot(bb_bot_big_2, color = t_color_big_2)
atomicbear96
@atomicbear96,
// 3. SMMA Multy timeframe
smma_len = input.int(7, minval=1, title="SMMA Length", group = "SMMA")
smma_src = input(close, title="SMMA Source", group = "SMMA")
// smma
smma = 0.0
smma_high = 0.0
smma_low = 0.0
smma := na(smma[1]) ? ta.sma(smma_src, smma_len) : (smma[1] * (smma_len - 1) + smma_src) / smma_len
smma_high := na(smma_high[1]) ? ta.sma(high, smma_len) : (smma_high[1] * (smma_len - 1) + high) / smma_len
smma_low := na(smma_low[1]) ? ta.sma(low, smma_len) : (smma_low[1] * (smma_len - 1) + low) / smma_len
// smma big
smma_big_src = nonRepaintingSecurity(syminfo.tickerid, big_interval ,close)
smma_big = 0.0
smma_big := na(smma_big[big_mult]) ? nonRepaintingSecurity(syminfo.tickerid, big_interval ,ta.sma(smma_big_src, smma_len)) : (smma_big[big_mult] * (smma_len - 1) + smma_big_src) / smma_len
// smma big 2
smma_big_src_2 = nonRepaintingSecurity(syminfo.tickerid, big_interval_2 ,close)
smma_big_2 = 0.0
smma_big_2 := na(smma_big_2[big_mult_2]) ? nonRepaintingSecurity(syminfo.tickerid, big_interval_2 ,ta.sma(smma_big_src_2, smma_len)) : (smma_big_2[big_mult_2] * (smma_len - 1) + smma_big_src_2) / smma_len
// draw
plot(smma, color = t_color)
plot(smma_big, color = t_color_big)
plot(smma_big_2, color = t_color_big_2)
Omni-Trading
@atomicbear96,
Can you send via pastebin ? thanks
atomicbear96
@OmniTekTrading,
I did not know pastebin well, so I published it.
tradingview.com/script/1eVeA6Lf-Uhokang-Bollinger-Band-BB-EMA-SMMA-SMA-Multy-timeframe/
Lebih lanjut