Show horizontal lines after the last point of EMA8, EMA21 and SMA50 from daily timeframe. Always shows the daily lines no matter the timeframe of your chart. It can be use as a reference in intraday time frames lower than 1 day.

Muestra líneas horizontales que continúan del último punto del EMA8, EMA21 y SMA50. Siempre muestra las líneas diarias sin importar el rango de tiempo que estés utilizando. Se puede usar como líneas de referencia para intradía.

Exponential Moving Average (EMA) horizontal_lines intraday lines Moving Averages references Simple Moving Average (SMA)


// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pacoed80
//@version=4
study("EMA SMA 1Day/Hor lines",overlay=true)
showline = input(title="Show lines of 1Day", defval=true, type=input.bool)
len1=input(8,"EMA 8 lin")
len2=input(21,"EMA 21 lin")
len3=input(50,"SMA 50 lin")
out1= security(syminfo.tickerid, "D", ema(close, len1))
out2= security(syminfo.tickerid, "D", ema(close, len2))
out3= security(syminfo.tickerid, "D", sma(close, len3))
c1 = input(title="EMA8", type=input.color, defval=color.blue)
c2 = input(title="EMA21", type=input.color, defval=color.red)
c3 = input(title="SMA50", type=input.color, defval=color.green)
lnwd=2
aline = out1 and showline and barstate.islast? line.new(time, out1,time+1, out1, xloc=xloc.bar_time,extend=extend.right,color=c1,style=line.style_solid,width=lnwd) : na
line.delete(aline[1])
bline = out2 and showline and barstate.islast? line.new(time, out2,time+1, out2, xloc=xloc.bar_time,extend=extend.right,color=c2,style=line.style_solid,width=lnwd) : na
line.delete(bline[1])
cline = out3 and showline and barstate.islast? line.new(time, out3,time+1, out3, xloc=xloc.bar_time,extend=extend.right,color=c3,style=line.style_solid,width=lnwd) : na
line.delete(cline[1])