Is there a way to use the calling bar reference inside a Ref ( ) function

#1
When we do a Ref(var1, -5) we get the value of array var1 from 5 bars ago. For example lets say we are at bar 100 looking back using ref.
Code:
Ref(HHV(H, rangeStoredinBarNumber100), -5);
value of array rangeStoredinBarNumber100 of bar number 95 is used in above formula. My question is is there a way to use the rangeStoredinBarNumber100 from the calling bar (bar number 100) in the above formula. Now you may say use the below.
Code:
Ref(HHV(H, Ref(rangeStoredinBarNumber100, 5)), -5);
But I used the number 5 just for example. In my code the variable that stores value 5 is an array. Which means I have to write some thing like below
Code:
Ref(HHV(H, Ref(rangeStoredinBarNumber100, lookbackbar)), -1 *lookbackbar); //this fails
However Since lookbackbar is an array it has a different value 5 bars down (at bar number 95). And since the above is enclosed in Ref() (outer ref) whatever variable is referred within it refers to bar 95. So the above fails. Am I making myself clear? Now is there a away I can use the lookbackbar variable of bar number 100 in bar number 95 without using Ref( ). Something like
Code:
Ref(HHV(H, Ref(rangeStoredinBarNumber100, Original(lookbackbar))), -1  *lookbackbar); //wishful thinking maybe
Or even better
Code:
Ref(HHV(H, Original(rangeStoredinBarNumber100)), -1  *lookbackbar); //wishful thinking maybe
Here Original(lookbackbar) refers to lookbackbar array value from bar 100. There is NO function called Original in AFL, it is just for the example. Is this possible?
 
Last edited:

Similar threads