once dentro=0
ema5=average[5,1](close)
ema50=average[50,1](close)
condiciones = ema5 crosses over ema50
if condiciones and dentro=0 then
buyprice=close
stoploss=close*0.95
takeprofit=close*1.05
dentro=1
drawarrowup(barindex,low)coloured("green")
endif
if dentro=1 and low<=stoploss then
sellprice=min(open,stoploss)
perf=round((sellprice-buyprice)/buyprice*100,2)
dentro=0
drawarrowdown(barindex,high)coloured("red")
drawtext("Rend:#perf# %",barindex, low)
elsif dentro=1 and high>=takeprofit then
sellprice=max(open,takeprofit)
perf=round((sellprice-buyprice)/buyprice*100,2)
dentro=0
drawarrowdown(barindex,high)coloured("red")
drawtext("Rend:#perf# %",barindex, low)
endif
return ema5 coloured("orange"), ema50 coloured("blue")