HHV Period Set to Zero

Hello everyone,

I have wriiten below exploration AFL to test my understanding for HHV. The period setting is variable, which is determined by C > MA(C, 5).
In the exploration table, I found the HHV(C, 0) is in essense to return the highest close up until the current bar. So far so good.

When it comes to HHV(C, Var), I cannot figure out, for example, why on date 1/24/2020 and 1/31/2020 HHV (C, Var) did not return the same value with HHV(C, 0)? In my understanding, Var took the value of "0" on those two days.

Thank you.

Var = IIf(C > MA(C, 5), 5, 0);

Filter = True;

AddColumn(C,"ClosePrice");
AddColumn(HHV(C, 0), "HHV(C, 0),");
AddColumn(Var, "Var",1.0);
AddColumn(HHV(C,Var), "HHV(C,Var)");

No, 0 is invalid parameter for HHV. You should use 1 or more.

1 Like