I want to read the highest high of future bars where my period (number of bars to look into the future) is changing based on the day of month. Below is the sample code for the same
d = Day(); HH = Ref(HHV(H,d),d); Plot(HH,"HH",colorBlue,styleLine);
The problem I am trying to solve is when let's say d = 5, the code first goes 5 bars ahead and then reads the HHV of the previous 'd' bars in which case, 5 bars ahead the value of 'd' has changed to say 10 (since d is a time variant array). So now effectively, HHV is being calculated on the range (-5 to +5 bars) and not only the future 5 bars.
How should I workaround the code to get the HHV of only the future 'd' bars where 'd' is a time variant array?