Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("My Script", overlay=true)
- ema1=ema(close, 100)
- plot(ema1)
- ema2=ema(close, 50)
- plot(ema2, color=color.red)
- enter=crossover(close, ema1)
- plotshape(enter, style=shape.triangleup,size=size.small, color=color.lime, location=location.belowbar, text="enter")
- exit=crossover(ema2, ema1)
- plotshape(exit, style=shape.diamond,size=size.small, color=color.yellow, location=location.abovebar, text="exit")
- aaa=barssince(enter)
- plot(aaa)
- bbb=barssince(exit)
- plot(bbb)
- long=aaa>bbb
- qqq=valuewhen(long,close,0)
- col=qqq==qqq[1]?color.yellow:na
- plot(qqq, color=col)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement