[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] MA : first value not computed ?



PureBytes Links

Trading Reference Links

Hello,

There is something strange with the MA function (and at least EMA), it
seems that the very first point at the beginning is not computed.

For instance, let's do the following: tmpArray = MA(Close,4); 
the first 4 cells in tmpArray are empty (more precisely filled with
EMPTY_VAL) while only 3 should be empty (the 4th value can be computed).

Or perhaps do I mistundertand something ? 

Thanks for your input! Nicolas

Here is small prg that illustrates this behaviour:

if (Name()=="AA") {
	tmpArray =  MA(Close,4);
	fh = fopen( "c:\\temp\\myfile.txt", "w");
	if(fh) { 
		for (i=0;i<BarCount;i++) {
		  tmp = StrFormat("%f %f \n",Close[i], tmpArray[i]); 
		  fputs(tmp,fh);
		}
	fclose(fh);
	} 
	Buy = 0;
	Sell = 0;
}

and myfile.txt contains:
31.889999 -10000000000.000000 
32.270000 -10000000000.000000 
29.809999 -10000000000.000000 
29.850000 -10000000000.000000 <- should be computed ??
29.760000 30.422501 
29.480000 29.725000 
...




 




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006