'Plot line from open to close

Currently have some code plotting a line above the open of each day. This plot starts at the correct value but I then get a diagonal line between values. I'm wanting to plot a horizontal line for the whole day instead, so this would be a horizontal line above the open from the initial value continuing until the close before resetting at the new value based on the new open.

There is no option for this on pine script reference manual that i can see so I'm really not sure where to start. I know its possible as I have seen similar things for other indicators so I'm potentially searching the wrong things.

Any help is very much appreciated.

Below is my current code

indicator("Jack AVG Hi Low", "Jack AVG HL", timeframe="D")


//user inputs
high_avg_period = input(12, "High AVG Period")

//calculations
avg_high = ta.sma(high-open, high_avg_period)

//plot
plot(close+avg_high, title='AVG High', color=color.green, linewidth=2, style=plot.style_stepline)

Below is a screenshot of all three plots as they currently are with diagonal lines between each days open.

Below is also a screenshot of the open plotted each day as I would like my lines plotted each day. Unfortunately the code is hidden.

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source