ATR Trend Following
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sharmasagar1

//@version=4
study("ATR Trend Following", overlay = true)
fun = sma(close, 350)[1]
fun2 = atr(14)[1]
p1 = fun + 7*fun2
p3 = fun + 5*fun2
//plot(fun, color = color.white)
plot(p1, color = color.green )
plot(p3, color = color.orange)
con1 = close[1] < p1[1] and close > p1
con2 = close[1] > p3[1] and close < p3

plotshape(con1, location = location.belowbar, text = "B")
plotshape(con2, location = location.abovebar, text = "S")