Simple to use for anyone trading a 20 length moving average.
Crossover is signaled once 20 MA crosses 1 MA at close of selected time interval.
Crossover is signaled once 20 MA crosses 1 MA at close of selected time interval.
study("Trend MA",overlay=true) plot(close,color=black, linewidth = 3,title="Close") long = sma(close,1) short = sma(close,20) plot(long, color = lime,title="Long",style = areabr) plot(short, color = red,title="Short",style =areabr) plot(cross(long, short) ? long : na,color=blue,style = cross, linewidth = 3,title="Crossover") src = close, len = 1 out = sma(src, len) out1 = security(tickerid, 'D', out)