Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("Drawing horizontal lines from signal entry points", overlay=true)
- // some basic indicator setup of MA's
- a = ema(close,14)
- b = ema(close, 34)
- // some MA plotting....
- plot(a)
- plot(b)
- //cross of MAs as event trigger
- cross_o = crossover(a,b)
- cross_u = crossunder(a,b)
- // determining the length of the line - you can replace the cross_o and cross_u with any other event
- l1 = barssince(cross_o)
- l2 = barssince(cross_u)
- // drawing the horizontal lines - you can replace the open also with high, low, and close OHLC values
- line lo = na
- line lu = na
- if cross_o or cross_u
- lo := line.new(bar_index[l1], open[l1], bar_index, open[l1], width = 4)
- lu := line.new(bar_index[l2], open[l2], bar_index, open[l2], width = 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement