DiZer

Multi-Timeframe Colored Bollinger Bands ( SMA 21), Fast EMA 8, S

Multi-Timeframe Colored Bollinger Bands ( SMA 21), Fast EMA 8, Slow SMA 200
Remove from Favorite Scripts Add to Favorite Scripts
study(title="BB color + MA MTF", shorttitle="BB color + MA MTF", overlay=true)
src = input(title="Source", type=source, defval=close)

//Bollinger Bands
lenb = input(21, title="Period Bollindger Bands")
time1 = input(3,"Different Timeframe 1")
time2 = input(5,"Different Timeframe 2")
mult1 = input(1.0, minval=0.001, maxval=5,title="Mult 1")
mult2 = input(2.0, minval=0.001, maxval=5,title="Mult 2")

atype = (1)
ccm = input(true,title="Change Bollinger Basis color")
ccf = input(true,title="Change Bollinger Background color")
ccmf = input(true,title="Change EMA fast color")
ccms = input(true,title="Change EMA slow color")

basis = sma(src, lenb)
dev1 = mult1 * stdev(src, lenb)
dev2 = mult2 * stdev(src, lenb)
upper = basis + dev1
lower = basis - dev1
upper1 = basis + dev2
lower1 = basis - dev2

lower_m1 = security(tickerid,tostring(time1),lower1)
upper_m1 = security(tickerid,tostring(time1),upper1)
lower_m2 = security(tickerid,tostring(time2),lower1)
upper_m2 = security(tickerid,tostring(time2),upper1)
pb10 = plot(upper, color=red, transp=0,title="Upper 1")
pb20 = plot(lower, color=green, transp=0,title="Lower 1")
pb1 = plot(upper1, color=red, transp=0,title="Upper 2")
pb2 = plot(lower1, color=green, transp=0,title="Lower 2")
pb3 = plot(upper_m1, color=blue, transp=0,title="Upper 3")
pb4 = plot(lower_m1, color=blue, transp=0,title="Lower 3")
pb5 = plot(upper_m2, color=yellow, transp=0,title="Upper 4")
pb6 = plot(lower_m2, color=yellow, transp=0,title="Lower 4")

//Multi МА
emab1 = ema(src, lenb)
emab2 = ema(emab1, lenb)
emab3 = ema(emab2, lenb)
temab = 3 * (emab1 - emab2) + emab3
avg = atype == 1 ? sma(src,lenb) : atype == 2 ? ema(src,lenb) : atype == 3 ? rma(src,lenb) : temab
outb = avg
ma_up = outb >= outb[mult2]
ma_down = outb < outb[mult2]
colMA = ccm ? ma_up ? green : ma_down ? red  : blue : blue
colB = ccf ? ma_up ? yellow : ma_down ? #F6CEEC  : yellow : yellow
fill(pb1, pb2, color=colB,title="Bollinger Bands Background",transp=85)
plot(outb, title="Basis", style=line, linewidth=3, color = colMA, transp=0)

//EMA
lenFast = input(8, minval=1, title="Fast EMA")
lenSlow = input(200, minval=1, title="Slow SMA")
emaFast = ema(src, lenFast)
emaSlow = sma(src, lenSlow)

//Fast EMA Final Color Rules
colEmaFast = ccmf?(emaFast>emaFast[1])?green:(emaFast<emaFast[1])?red:green:blue
colEmaSlow = ccms?(emaSlow>emaSlow[1])?lime:(emaSlow<emaSlow[1])?#8A0829:black:orange
plot(emaFast, title="Fast EMA", style=line, linewidth=2, color=colEmaFast,transp=60)
plot(emaSlow, title="Slow SMA", style=line, linewidth=4, color=colEmaSlow,transp=0)
Just want to say thanks. I think it's great.
Reply
EN English (UK)
EN English
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
HE עברית
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Get Help Ideas Published Followers Following Private Messages Chat Sign Out