My indicator is running on the 15 minute chart and I need to get the high of a previous 4hr candle. I have similar code working at the start that works fine. However this one section is giving me a compile error, not code is highlighted red. The 4hr candle I am looking for is high[2]
. It is this that is causing the error request.security(syminfo.tickerid, "240", high[2])
If I replace with just high[2]
then there is no error
My code is:
if filteredtopf
current_fractal_high := request.security(syminfo.tickerid, "240", high[2])
current_fractal_high_index := bar_index-2
if range_high == high[2]
range_high_fractal := true
The issue was because it was inside an if
statement. I removed from there and placed inside a function which I then call from the if