I've seen many indicators that mark the range of forex trading sessions.
In a similar manner I'd like to draw a rectangle around all the candles between 15:00 - 18:00 GMT+2.
I'd like the top of the rectangle to be on top of the high in that range and the bottom at the low of the range.
I've tried looking at the code that they used in some of the forex trading session indicators but I'm new to all this and it went over my head. I'm also still becoming accustomed to using documentation and being able to practically create implementations from documentation.
I've tried the following:
//@version=5
indicator('My Indicator', overlay = true)
// Define the start and end times for the rectangle
startTime = timestamp(year, month, day, 10, 0, 0) - time('50D')
endTime = timestamp(year, month, day, 11, 0, 0) - time('50D')
// Use a for loop to iterate over the days in the data
for i = 0 to 49
// Get the high and low values for the rectangle
highValue = highest(high[range(startTime, endTime)])
lowValue = lowest(low[range(startTime, endTime)])
// Draw the top and bottom lines of the rectangle
hline(highValue, startTime, endTime, color=color.orange)
hline(lowValue, startTime, endTime, color=color.orange)
// Draw the left and right lines of the rectangle
vline(startTime, highValue, lowValue, color=color.orange)
vline(endTime, highValue, lowValue, color=color.orange)
// Increment the start and end times to the next day
startTime := startTime + time('1D')
But I received the error:
10:11:36 PM — Compilation error. Line 12: Mismatched input 'highValue' expecting 'end of line without line continuation'
How can I get this to work?