Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("EMA Crossover", overlay=true)
- // Define the EMA lengths for short and long EMAs
- short_lenght=input.int(12,title = "short_lenght")
- long_lenght=input.int(21,title = "long_lenght")
- // Calculate short and long EMAs
- short_ema=ta.ema(close,short_lenght)
- long_ema=ta.ema(close,long_lenght)
- // Plot the short and long EMAs
- plot(short_ema,title = "short_ema",color=color.red)
- plot(long_ema,title="long_ema",color=color.green)
- // Create crossover conditions
- crossover=ta.crossover(short_ema,long_ema)
- crossunder=ta.crossunder(short_ema,long_ema)
- // Plot buy and sell signals
- plotshape(crossunder,title = "SellSignal",color = color.red,location = location.abovebar,style=shape.triangledown,size = size.small)
- plotshape(crossover,title = "BuySignal",color=color.aqua,location = location.belowbar,style=shape.triangleup,size=size.small)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement