# How to draw a horizontal line at position -1

Hello,

I want to be able to draw a horizontal line between position 0 and position -1. I can do now between position 1 and position 0, thanks to the help in this post: https://www.mql5.com/en/forum/437621 but 0 to -1 doesn't work.

I'd thought about using OBJ_HLINE and using the Ray Right function but I don't want the line to extend to the extreme right, only one bar.

Any ideas anyone?

Horizontal Line between two candles
• 2022.12.08
• www.mql5.com
Hello, I'm using this code to try and draw a horizontal line between two adjacent candles...

1. A HLine is continuous all the way across. Ray is irrelevant. You want a TLine with start and stop times.
2. imamushroom: draw a horizontal line between position 0 and position -1. I can do now between position 1 and position 0,
There is no position -1. Estimate the time as Time[0] + PeriodSeconds().

William Roeder #:
1. A HLine is continuous all the way across. Ray is irrelevant. You want a TLine with start and stop times.
2. There is no position -1. Estimate the time as Time[0] + PeriodSeconds().

Ok thanks