Value of Moving average Not Matching the actual average !!

 

Hi all,

I have come across a strange thing,

I've opened the GBPUSD daily chart, applied a 200 simple moving average on close values, the value of the 200 SMA was 1.5487

then I have downloaded the values (File,Save as) and calculated the average of the last 200 candles, and it was 1.5121 different from the indicator reading !!

any explanation ?


 
I'm just guessing here. However the first thing that comes to my mind is the Difference in Points. Your chart may show 4 digits after the decimal point. Or the value you save might be 4-digits after the decimal point. The indicator on the other hand might be using 5 or more digits after the decimal point. The way I check this is to draw a Horizontal line using the line tool above. Then I double click it, then try to verify the value of the price it returns. Check that in the mean-time til someone who have a better explanation comes along. Again I'm just guessing here.
 
t4fast:

Hi all,

I have come across a strange thing,

I've opened the GBPUSD daily chart, applied a 200 simple moving average on close values, the value of the 200 SMA was 1.5487

then I have downloaded the values (File,Save as) and calculated the average of the last 200 candles, and it was 1.5121 different from the indicator reading !!

any explanation ?


Are you sure you are using the close and the right formula because I'm getting correct numbers. Please post a screen-shot of your spreadsheet.

-

 

To further confirm my findings,

i've looked at a different platform (real account)

and the moving average is indeed different. Please compare the last candles (for example)



4 digits average and a 5 digits average will not be that apart.



 

I did some investigation and I'm getting the same SMA as the Indicator in MT4. Attached is my script and my output file. Make sure you're using SMA instead of SMMA.

int start(){
//#################################################################
//#################################################################
int File1=FileOpen("Close200.csv",FILE_WRITE,',');
for(int a=1;a<=200;a++){
   FileWrite(File1,Close[a]);
}
//#################################################################
//#################################################################
double Simple_MA=iMA(NULL,0,200,0,MODE_SMA,PRICE_CLOSE,1);
FileWrite(File1,Simple_MA);Alert(Simple_MA);
FileClose(File1);
//#################################################################
//#################################################################
return(0);} 
Files:
close200.txt  2 kb
Reason: