lonestar108

SMA Intersection Enhanced

729
Enhanced SMA cross by Ersoy showing positive SMA candle crosses in lime, negative in orange.

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?
//@version=2
study("SMA Intersection Enhanced")

len1=input(title="Enter Short  Day", type=integer, defval=1)
src1=input(close, title="Source")
short = sma(src1,len1)

len2=input(title="Enter Long Day", type=integer, defval=9)
src2=input(close, title="Source")
long = sma(src2,len2)

plot(short, color = green,title="Short",style = areabr)
plot(long, color = red,title="long",style =areabr)

plot(cross(short, long) ? short : na,color=(long-short <0 ? lime:orange),style = circles, linewidth = 5,title="İntersection Point")

src = close, len = 1
out = sma(src, len)

barcolor(cross(short,long) ?  (long-short <0 ? lime:orange):na)
plotchar(cross(short,long) ? short:na , char='!', location=location.absolute, color=black,title="Alarm", text="!")