Hi I was wondering if anyone could help me… I’m trying to write an indicator that will find a rectangle on the chart and extend it out to the current bar. I want to draw supply and demand zones myself using the rectangle, but I want it to automatically extend (and stay updated) to current bar.
Any ideas?
Hi Rudy, I moved your query to a new specific thread.
To draw a rectangle that will always be drawn to the last bar, you must use the BARINDEX instruction as the second X-axis coordinate, like this:
Example of a support zone:
x1 = barindex-50
y1 = lowest[50](low)[1]
DRAWRECTANGLE(x1,y1,barindex,y1) COLOURED(255,0,0,100)
RETURN
Thank you Nicolas! Do you know how I would get the indicator to only apply this extension to a manually drawn rectangle? I don’t want it to draw a rectangle on its own, only extend the ones I draw.
It cannot be done by code I’m sorry. I did not read well your request of your first post sorry..