how can i bring line back to candles the lines should move with each new candle moving forward

32 Views Asked by At

how can i bring line back to candles the lines should move with each new candle moving forward. which value should i change bring the line to candle.

if barstate.islast and dispOHLC
ohlcC = htf_o1 > htf_c1 ? color.red : color.green
style_ohlc = f_getStyle(i_style_ohlc)

if i_show_o
f_drawLineX(time_x10, htf_o1, time_x21, htf_o1, xloc.bar_time, extend.none, ohlcC, style_ohlc, 1)
f_drawLabelX(time_x1, htf_o1, 'O', xloc.bar_time, yloc.price, #00000000, label.style_label_right, ohlcC, size.normal, text.align_center, 'PREVIOUS HTF(' + htf + ') OPEN : '  + str.tostring(htf_o1, format.mintick))

if i_show_h
f_drawLineX(time_x10, htf_h1, time_x21, htf_h1, xloc.bar_time, extend.none, ohlcC, style_ohlc, 2)
f_drawLabelX(time_x1, htf_h1, 'H', xloc.bar_time, yloc.price, #00000000, label.style_label_right, ohlcC, size.normal, text.align_center, 'PREVIOUS HTF(' + htf + ') HIGH : '  + str.tostring(htf_h1, format.mintick))

if i_show_l
f_drawLineX(time_x10, htf_l1, time_x21, htf_l1, xloc.bar_time, extend.none, ohlcC, style_ohlc, 2)
f_drawLabelX(time_x1, htf_l1, 'L', xloc.bar_time, yloc.price, #00000000, label.style_label_right, ohlcC, size.normal, text.align_center, 'PREVIOUS HTF(' + htf + ') LOW : '   + str.tostring(htf_l1, format.mintick))

if i_show_c
f_drawLineX(time_x10, htf_c1, time_x21, htf_c1, xloc.bar_time, extend.none, ohlcC, style_ohlc, 1)
f_drawLabelX(time_x1, htf_c1, 'C', xloc.bar_time, yloc.price, #00000000, label.style_label_right, ohlcC, size.normal, text.align_center, 'PREVIOUS HTF(' + htf + ') CLOSE : ' + str.tostring(htf_c1, format.mintick))

if f_crossingLevelX(close, htf_h1) and barstate.islast and dispOHLC
alert('OHLC (PVTvX) : ' + syminfo.ticker + ' crossing previous htf high')
if f_crossingLevelX(close, htf_l1) and barstate.islast and dispOHLC
alert('OHLC (PVTvX) : ' + syminfo.ticker + ' crossing previous htf low')    ```
0

There are 0 best solutions below