standard deviation on buffer? why MAs?

 

This function https://docs.mql4.com/indicators/iStdDevOnArray

iStdDevOnArray has a whole load of functions to do with moving averages?

Isn;t a standard deviation just a simple calculation of the data in the array like in Excel?

 

Indeed, but you can limit the used array lenght. For example if you only want to know the stdDev for the last 5 bars.

Add: also in the Standart deviation a 'moving average' is used, it's the average of the data in the array.

(If you look at the formula for the standard deviation you will see that an average is needed to calculate the deviation) You maybe better understand first what standard deviation means....

 
You are always calculate the same average for each iteration
 

I see....MODE_EMA,i instead of MODE_EMA, 0.

Thanks

 

Hints:

ArraySize(Buf_0) == BARS will be true for each interation

-> array_av_ct = BARS

only on the last iteration step Buf_0 is a fully filled and initialized array.

-> the key to your solutions is the last parameter of the iMAOnArray function

 
SanMiguel:
iStdDevOnArray has a whole load of functions to do with moving averages?
Better learn what Std Dev is. It is a measure of the average deviation of a bar relative to a moving average of that bar.
 

In Excel, you work out the standard deviation on an array of values.

Now, I want to calculate this for the last month only, so I put in 720 bars but it doesn't seem to make a difference?

Reason: