I want to develop a very basic indicator that draws a horizontal line on the live chart based on the following criteria.
When: Starting at session open after every X bars (resetting at session close)
What: The average price of the previous X bars
Distance of horizontal line drawn should be equal to number of X bars chosen.
All X variables should be equal.
For example, 5 minute chart, X bar variable set to 12, instrument ES
I would want the indicator to start running at 6pm eastern (session open) and after the first 12 bars (1 hour) a horizontal line stretching right the length of the next 12 bars will be drawn at the average price of the first/previous 12 bars (6 to 7pm) I would like the indicator to continue to run until session close drawing a new horizontal line every 12 bars.
All horizontal lines should stay visible.
I'm watching videos and looking at other indicator code as guidance, but I am having a rough time writing my own code.
Could someone help me get started?
Thank you so much,
Mark

Comment