Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //@version=4
  2. study("Drawing horizontal lines from signal entry points", overlay=true)
  3.  
  4. // some basic indicator setup of MA's
  5. a = ema(close,14)
  6. b = ema(close, 34)
  7.  
  8. // some MA plotting....
  9. plot(a)
  10. plot(b)
  11.  
  12. //cross of MAs as event trigger
  13. cross_o = crossover(a,b)
  14. cross_u = crossunder(a,b)
  15.  
  16. // determining the length of the line - you can replace the cross_o and cross_u with any other event
  17. l1 = barssince(cross_o)
  18. l2 = barssince(cross_u)
  19.  
  20.  
  21. // drawing the horizontal lines - you can replace the open also with high, low, and close OHLC values
  22. line lo = na
  23. line lu = na
  24. if cross_o or cross_u
  25. lo := line.new(bar_index[l1], open[l1], bar_index, open[l1], width = 4)
  26. lu := line.new(bar_index[l2], open[l2], bar_index, open[l2], width = 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement