Hi

Wrting out the value of  the expression BarsSince(NOT(IsNull(Calc1))) , the 
value is constant 0. 

SetBarsRequired(-2,-2); 
Calc1 = C - MA(C,30); 
Mean = Cum(Calc1) / Cum(1);
SumOfSquare = Cum( (Calc1 - mean) * (Calc1 - mean)); 
Std  = sqrt(SumOfSquare/ BarCount) ; 
bars = BarsSince(NOT(IsNull(Calc1))); 
"Bars = " + bars; 
"Calc1 = " + Calc1; 
"Mean = " + Mean;
"Std = " + Std; 

There's also AFL function StDev(Array,Periods),  however, when I try Std = 
StDev(Calc1,BarCount), the result is 0. 

But I don't know why. 

Rds
SW



________________________________
From: pmxgs <[email protected]>
To: [email protected]
Sent: Saturday, April 11, 2009 3:48:45 AM
Subject: [amibroker] Average and Standard Deviation for all data





Hi,

I would like to calculate the average and standard deviation for all the data 
available in an array.
For example:

calc1=C-ma(C, 30);

I would like now to calculate an average and std. dev. of calc1 which gets 
updated as new bars appears.
This average and std. dev. include all the available data.

I have tried MA(calc1,barssince( not(isnull( calc1)))) ; but it doesn't work.

Any suggestions?

thanks 





      

Reply via email to