Advertisement
danucante

Untitled

Oct 15th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. //@version=5
  2. indicator("EMA Crossover", overlay=true)
  3.  
  4. // Define the EMA lengths for short and long EMAs
  5. short_lenght=input.int(12,title = "short_lenght")
  6. long_lenght=input.int(21,title = "long_lenght")
  7. // Calculate short and long EMAs
  8. short_ema=ta.ema(close,short_lenght)
  9. long_ema=ta.ema(close,long_lenght)
  10.  
  11. // Plot the short and long EMAs
  12. plot(short_ema,title = "short_ema",color=color.red)
  13. plot(long_ema,title="long_ema",color=color.green)
  14. // Create crossover conditions
  15. crossover=ta.crossover(short_ema,long_ema)
  16. crossunder=ta.crossunder(short_ema,long_ema)
  17. // Plot buy and sell signals
  18. plotshape(crossunder,title = "SellSignal",color = color.red,location = location.abovebar,style=shape.triangledown,size = size.small)
  19. plotshape(crossover,title = "BuySignal",color=color.aqua,location = location.belowbar,style=shape.triangleup,size=size.small)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement