iMAOnArray issue. - page 2

 
phy:

Index Buffer arrays are series arrays by default. They will be intialized with the SetIndexBuffer() function.

Other arrays are not, and have to be set as "series", for use with any of the iXXXOnArray() functions.

.

If using iMAOnArray, the array must be a "series" array.

I would say DO NOT use the "total" paramter, I never have, and don't have problems. Leave it zero. This thread is about "buggy" results when "total" is not zero.

.

You don't have to use the default ExtMapBuffer1-8 names, by the way.

LOL.. I just copy/pasted ExtMapBuffer names.


I decided to write my own moving average code. At least I know it works.


phy, thanks a bunch for your help. I appreciate you taking your time to assist me.

 
Dear friends:
this is my comprehension,please see as follow:
//the total parameter is 0,because the size of the array is 10,the average value is calculated from right to left,first print is 9
Print("Total=Zero: " + iMAOnArray(testArray, 0, 3, 0, MODE_SMA, 0)); //prints Total=Zero: 9 
//the size of the array is 3,it is subset of testArray,in other words,testArray[7],testArray[8],testArray[9],so the second print is 9
Print("Total=Three: " + iMAOnArray(testArray, 3, 3, 0, MODE_SMA, 0)); //prints Total=Three: 9

//the total element number is 3,testArray[0],testArray[1],testArray[2],the print is 2
Print("Total=Three: " + iMAOnArray(testArray, 3, 3, 0, MODE_SMA, 0)); //prints Total=Three: 2
//the size of the testArray is 3 because of the above procedure,the elements is testArray[0],testArray[1],testArray[2],the average value is calculated from right to left,
//and the print is 2
Print("Total=Zero: " + iMAOnArray(testArray, 0, 3, 0, MODE_SMA, 0)); //prints Total=Zero: 2 

hope it is helpful!