How to convert an array to a number?

How to convert an array to a number? Thanks!

1 Like

Well, you can’t simply convert the whole array to just one number. By definition an array consists of many numbers. Converting all of them to one number is like converting your name and surname to just one letter. If someone asked you to do that, you would have to pick just one letter - the first, the last or any other. Of course (in case of numbers), you can always calculate average value of the whole array. Study these functions:

… but start from this tutorial:


… and

1 Like

Thank you Milosz

I used PriceVolDistribution in the afl and it showed the error about the array problem:

bi = BarIndex();
nd = DateNum() != Ref(DateNum(), -1); //NewDay
eod = Ref(nd, 1); //End of Day
fvb = ValueWhen(nd, bi, 1);
lvb = ValueWhen(eod, bi, 0);
mx = PriceVolDistribution(H, L, V, 100, False, fvb, lvb);