Why can't I do this?

Why does this work:

MA(C,Cum(1));

But this gives an error:

StDev(C,Cum(1));

You need to update AmiBroker. StDev does allow variable period since AB 6.19.
As for why Stdev returns error in your older AB version:
Cum() returns type array and MA() function allowing type number or array as period but StDev() expecting period to be type number only (in your older AB version).

In general native indicators allowing variable period are listed here
https://www.amibroker.com/guide/a_varperiods.html
All others don't.

But to allow any function to allow variable period read here (especially last two functions)

Hint: you would have to replace ROC by StDev in first function of last code.

3 Likes