EMA Power Bands
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © shncoskunn


//@version=4
study(title="EMA Power Bands", shorttitle="EMA Power Bands", overlay=true)

ATRlength = input(200, minval=1)
ATRMult = input(2.272, minval=1)

ATR = rma(tr(true), ATRlength)

//EMA
len = input(21, minval=1, title="EMA Length")
src = input(close, title="Source")
out = ema(src, len)
plot(out, title="EMA", color=color.rgb(255, 115, 0),transp=85)

//rsı 
Rsi_value=input(14,title="RSI Uzunluğu",step=1)
hl=input(80,title="RSI Aşırı Alım Eşiği",step=1)
ll=input(25,title="RSI Aşırı Satım Eşiği",step=1)
rs=rsi(close,Rsi_value)

//EMA Bands
emaup = out+(ATR*ATRMult)
emadw = out-(ATR*ATRMult)
plot(emaup, title="EMAUP", color=color.red, linewidth=3)
plot(emadw, title="EMADW", color=color.green, linewidth=3)


//Conditions for Bullish and Bearish Flags
plotshape(close > emaup, style=shape.arrowdown,location=location.abovebar,color=color.red, size=size.small, text="🔨")
plotshape(close < emadw, style=shape.arrowup,location=location.belowbar,color=color.green, size=size.small, text="🚀")

//Buy/Sell Signals based on RSI
buy_signal = rs < ll ? 1 : 0
sell_signal = rs > hl ? 1 : 0

plotshape(buy_signal, title="Buy Signal", style=shape.triangleup, location=location.belowbar, color=color.green, text="🔋")
plotshape(sell_signal, title="Sell Signal", style=shape.triangledown, location=location.abovebar, color=color.red, text="🪫")