sud1234
sud1234

Reputation: 1

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

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.

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

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 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( ). Some thing like

Ref(HHV(H, Ref(rangeStoredinBarNumber100, Original(lookbackbar))), -1  *lookbackbar); //wishful thinking maybe

Or even better

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?

Upvotes: 0

Views: 183

Answers (1)

Dicer
Dicer

Reputation: 85

Don't understand your question. Why don't you change -5 to -100 to have 100 look back bar

Upvotes: 0

Related Questions