Power of Stock's Trading Idea
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mortal_glitch

//@version=5
indicator("Power of Stocks Trading Strategy",shorttitle="POS", overlay=true)
showEMA    = input(title="Show EMA Sell",  defval=true)
showIB    = input(title="Show Inside Bar",  defval=true)

//Inside Bars
RR=input.float(2, minval=1, title="Risk:Reward Ratio")
showST    = input(title="Show SL & Target",  defval=true)
insideBar() => high[1] <= high[2] and low[1] >= low[2] ? 1 : 0
draw_line(y,col,sty)=>line.new(x1=time-(10*60*1000),y1=y,x2=time+(60*60*1000),y2=y, color=col,xloc= xloc.bar_time, style=sty)
draw_label(y)=>
    display_text =str.format(" ({0})", math.round_to_mintick(y)) 
    label.new(x = time+(60*60*1000), y=y, text=display_text, textcolor=color.new(color.white,50), color=#00000000, xloc=xloc.bar_time)
if insideBar() and close>=high[1] and not(barstate.islast) and not(barstate.isfirst) and showIB and showST
    draw_line(high[1],color.white,line.style_solid)
    draw_line(low[2],color.red,line.style_dashed)
    draw_label(low[2])
    draw_line((high[1]+(RR*(high[1]-low[2]))),color.green,line.style_dashed)
    draw_label(high[1]+(RR*(high[1]-low[2])))
if insideBar() and close<=low[1] and not(barstate.islast) and not(barstate.isfirst) and showIB and showST
    draw_line(low[1],color.white,line.style_solid)
    draw_line(high[2],color.red,line.style_dashed)
    draw_label(high[2])
    draw_line((low[1]-(RR*(high[2]-low[1]))),color.green,line.style_dashed)
    draw_label((low[1]-(RR*(high[2]-low[1]))))

//5EMA
ema5 = ta.ema(close, 5 )


sl=high>high[1]?high:high<high[1]?high[1]:0
tar=low[1]-(RR*(sl-low[1]))
plotshape( low[1]>ema5 and open[1]>close[1] and close<close[1] and showEMA and not(barstate.isfirst), title="Sell Label", text="SELL",color=color.new(#FF000D,50), location=location.abovebar, style=shape.labeldown, size=size.tiny, textcolor=color.white)
if low[1]>ema5 and open[1]>close[1] and close<close[1] and showEMA and showST and not(barstate.isfirst)
    draw_line(sl,color.red,line.style_dotted)
    draw_label(sl)
    draw_line(tar,color.green,line.style_dotted)
    draw_label(tar)
    draw_line(low[1],color.white,line.style_solid)
    