valueWhen for referencing future

#1
I am trying to read a value from future bar. For example if i am at bar 10 I am reading a value from bar 20. Bar 20 has occurred. I use n=0 in valueWhen. But valuewhen does not fetch the value. Why?
see the chart below.

Code:
h1=186.8;
x=IIf(H==h1, 10000, 2);
_Trace("ValueWhen(H==h1, x, 0)="+ValueWhen(H==h1, x, 0));
_TRACE("H==h1 ="+(H==h1)+", x="+x);
questionvaluewehen.png
 

Similar threads