2

I'm trying to figure out how to plot a line from one specific time to another specific time in Pine Script / TradingView.

I'd like to plot from the close price at 14:00 to the close price at 15:30 (exchange time). - If it isn't 15:30 yet, then plot to the close of the most recent bar.

This seems like it should be easy to do, but I can't figure it out. Any help would be greatly appreciated!

1 Answer 1

1

Something basic like this could do it

//@version=5 indicator("My script", "t", true) var line l = na if hour == 14 and minute == 0 l := line.new(time, close, time, close, xloc = xloc.bar_time) if 14 <= hour and (hour < 15 or minute < 30) and hour < 16 line.set_xy2(l, time, close) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.