I’ve updated the code of the trend indicator I created, which allows you to visualize trends from 1h/4h/1d/1w, and i’ve added the monthly trend.
You're asking why I added it? Well, it’s time to pay attention and turn monthly trend on.
You can view all the trends simultaneously on any timeframe, change their colors, display only some of them, exclude others, and modify their style.
I personally use 15Ema/Sma, so change the value, should be 20 by default
//@version=4
study(title="Trend 15 MultiTF + Monthly", overlay=true)
// Definiamo la lunghezza delle SMA
len0 = input(title="SMA Monthly Length", type=input.integer, defval=20)
len1 = input(title="SMA Weekly Length", type=input.integer, defval=20)
len2 = input(title="SMA Daily Length", type=input.integer, defval=20)
len3 = input(title="SMA 4 Hours Length", type=input.integer, defval=20)
len4 = input(title="SMA 1 Hour Length", type=input.integer, defval=20)
// Definiamo la lunghezza delle EMA
len5 = input(title="EMA Monthly Length", type=input.integer, defval=20)
len6 = input(title="EMA Weekly Length", type=input.integer, defval=20)
len7 = input(title="EMA Daily Length", type=input.integer, defval=20)
len8 = input(title="EMA 4 Hours Length", type=input.integer, defval=20)
len9 = input(title="EMA 1 Hour Length", type=input.integer, defval=20)
// Definiamo le serie temporali
src = input(close, title="Source")
res0 = "M"
res1 = "W"
res2 = "D"
res3 = "240"
res4 = "60"
// Calcoliamo le SMA
sma0 = security(syminfo.tickerid, res0, sma(src, len0))
sma1 = security(syminfo.tickerid, res1, sma(src, len1))
sma2 = security(syminfo.tickerid, res2, sma(src, len2))
sma3 = security(syminfo.tickerid, res3, sma(src, len3))
sma4 = security(syminfo.tickerid, res4, sma(src, len4))
// Calcoliamo le EMA
ema0 = security(syminfo.tickerid, res0, ema(src, len5))
ema1 = security(syminfo.tickerid, res1, ema(src, len6))
ema2 = security(syminfo.tickerid, res2, ema(src, len7))
ema3 = security(syminfo.tickerid, res3, ema(src, len8))
ema4 = security(syminfo.tickerid, res4, ema(src, len9))
// Disegniamo le linee
plot(sma0, "SMA Monthly", color=color.orange, transp=0, linewidth=2)
plot(ema0, "EMA Monthly", color=color.aqua, transp=0, linewidth=2)
plot(sma1, "SMA Weekly", color=#FFA07A, transp=0, linewidth=2)
plot(ema1, "EMA Weekly", color=#ADD8E6, transp=0, linewidth=2)
plot(sma2, "SMA Daily", color=#FFA07A, transp=0, linewidth=2)
plot(ema2, "EMA Daily", color=#ADD8E6, transp=0, linewidth=2)
plot(sma3, "SMA 4 Hours", color=#FFA07A, transp=0, linewidth=2)
plot(ema3, "EMA 4 Hours", color=#ADD8E6, transp=0, linewidth=2)
plot(sma4, "SMA 1 Hour", color=#FFA07A, transp=0, linewidth=2)
plot(ema4, "EMA 1 Hour", color=#ADD8E6, transp=0, linewidth=2)
good luck, ciao