This is a script I made to do what is called math (if you're not sure, Google it). It will take the first open, the last close, and the highest high and lowest low from a range of , and plot it on top of the chart.
Unfortunately, there is no way to make it so you can move it with your mouse, and the bar numbering is not the same as the regular drawing tools, so to figure out what the line number is, create a new script with the text:
This will create another chart that will show you the bar numbers that correspond to the script's bar numbers. From there, figure out where you want to start the math, and enter that number in the "Start" field in the inputs for this script.
study("Candlestick Math","CndlMth",overlay=true) inStart = input(2610,"Start",integer,minval=0) inLen = input(3,"Length",integer,minval=2) inSym = input("*","Symbol",symbol) len = inLen-1 start = inStart end = inStart + len isIn = (n >= start) and (n <= end) and (inSym == tickerid) o = isIn ? (na(o) ? fixnan(open) : o) : na c = isIn ? (na(c) ? fixnan(close[round(-len)]) : c) : na h = isIn ? (na(h) ? highest(fixnan(high[round(-len)]),len+1) : h) : na l = isIn ? (na(l) ? lowest(fixnan(low[round(-len)]),len+1) : l) : na fill(plot(h,title="High"),plot(l,title="Low"),color=gray,transp=50) plot(o,title="Open",color=iff(o > c,red,green),linewidth=4) plot(c,title="Close",color=iff(o > c,red,green),linewidth=4)