i running into some issues while using bar_index stored in variable to calculate the highest() in a range.
In my study i store the bar_index into a global variable f_barindex_enter := bar_index
when i enter a position. After leaving the position i'm trying to retrieve the highest price between enter and exit f_barindex_distance = bar_index[0] - f_barindex_enter
for further use in my study.
What i found is that when using highest(f_barindex_distance)
generates a error when i apply the study on a chart. Pinescript help says that bar_index returns a integer but doesn't seem to work with highest(). I also tried to 'force' convert the variable to a integer by using int() but also generates a error.
am i doing something wrong?