How can you plot two horizontal lines. 1 line at the highest price of the most recent 2 candles and 1 line at the lowest price of the most recent 2 candles, using pine script?
//@version=4
study("Help", overlay=true)
var ln_max = line.new(na, na, na, na, extend=extend.left, color=color.orange)
var ln_min = line.new(na, na, na, na, extend=extend.left, color=color.blue)
H2=max(high[1], high[0])
L2=min(low[1], low[0])
if bar_index > 1
line.set_xy1(ln_max, bar_index - 1, H2)
line.set_xy2(ln_max, bar_index, H2)
line.set_xy1(ln_min, bar_index - 1, L2)
line.set_xy2(ln_min, bar_index, L2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.