TerenceTam

EMA_Music_Stave_by_Cowbearcar

Using EMA 7, 20, 38, 62, 100 to make music stave/staff on Stock View. Besides, using 2H-L to catch High/Low if possible, you would see the lines always touching every Candle High/Low, just few outgoing and you can try to eat when it back to calculated line: (2*Ema7 - Ema20) or (2*Ema4 - Ema10) or (2*Ema7 - Ema38). but as I just newbie on script, just simple copy and modify little, I would like to add arrow on calculated line V Turn or calculated line crossover, beside, standard Ema4, 7 crossover should give an arrow too.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Created By Cowbearcar on 10/24/2015 by Request for 2use
//EMA to make Music Stave and give some more Hidding line to test the High/Low if possible
study(title="EMA_Music_Stave_by_Cowbearcar", shorttitle="EMA_Music_Stave", overlay=true)
src = close, 
len1 = input(7, minval=1, title="EMA7")
len2 = input(20, minval=1, title="EMA20")
len3 = input(38, minval=1, title="EMA38")
len4 = input(62, minval=1, title="EMA62")
len5 = input(100, minval=1, title="EMA100")
len6 = input(162, minval=1, title="EMA162")
len7 = input(4, minval=1, title="EMA4")
len8 = input(10, minval=1, title="EMA10")

//EMA STAVE
ema1 = ema(src, len1)  // Ema 7
ema2 = ema(src, len2)  // Ema 20
ema3 = ema(src, len3)  // Ema 38
ema4 = ema(src, len4)  // Ema 62
ema5 = ema(src, len5)  // Ema 100
ema6 = ema(src, len6)  // Ema 162
ema7 = ema(src, len7)  // Ema 4
ema8 = ema(src, len8)  // Ema 10
//EMA DIFF
emadiff1 = 2 * ema7 - ema8    // 2*EMA4 - EMA10
emadiff2 = 2 * ema1 - ema2    // 2*EMA7 - EMA20
emadiff3 = 2 * ema1 - ema3    // 2*EMA7 - EMA38
emadiff4 = 2 * ema1 - ema4    // 2*EMA7 - EMA62
emadiff5 = 2 * ema1 - ema5    // 2*EMA7 - EMA100
emadiff6 = 2 * ema1 - ema6    // 2*EMA7 - EMA162

//Fast EMA Color Rules
colfastL = (ema1 > ema2 )
colfastS = (ema1 < ema2 )
//Slow EMA Color Rules
colslowL = (emadiff2 > emadiff3)
colslowS = (emadiff2 < emadiff3)
//Fast EMA Final Color Rules
colFinal = colfastL and colslowL? aqua : colfastS and colslowS? orange : gray
//Slow EMA Final Color Rules
colFinal2 = colslowL  ? lime : colslowS ? red : gray
//Fast EMA Plots
p1=plot(ema1, title="EMA7", style=line, linewidth=2, color=colFinal)
plot(ema2, title="EMA20", style=line, linewidth=1, color=colFinal)
plot(ema3, title="EMA38", style=line, linewidth=1, color=colFinal)
plot(ema4, title="EMA62", style=line, linewidth=1, color=colFinal)
plot(ema5, title="EMA100", style=line, linewidth=1, color=colFinal)
p2=plot(ema6, title="EMA162", style=line, linewidth=2, color=colFinal)
fill(p1,p2,color=gray, transp=60)
//Slow EMA Plots
p3=plot(emadiff1, title="2*EMA4 - EMA10", style=line, linewidth=1, color=colFinal2)
plot(emadiff2, title="2*EMA7 - EMA20", style=line, linewidth=2, color=colFinal2)
p4=plot(emadiff3, title="2*EMA7 - EMA38", style=line, linewidth=1, color=colFinal2)
fill(p3,p4, color=silver, transp=60)