MAJOR PROBLEM WITH METATRADER

 
Hey,

I have a major problem with metatrader that I noticed a few weeks ago and it seemed so serious that I tried to pretend it wasn't happening, but it is, and I can't avoid it any longer.

If you plot a high period MA, such as 600 EMA, from an EA, and use Print() to give you the value of that MA at a specific time, the value that Print() returns and the value of that same EMA on the chart will differ substantially.

For example, look at the following picture. I'm using a 1296 EMA, and on the 5-minute chart, it says that at on September 14th, 01:35, the EMA is at 1.65624.

But if you look at the Print() function for the same exact time, it gives a value of 1.66074.

But don't just take my work for it, try this code yourself and you'll see what I mean.



 extern int baseperiod=1200; 
 extern double TF=PERIOD_M5;
 extern string tim="01:35";
 
 
 double ZZ;
 
 int start() { 
 
 if(ZZ!=iTime(NULL,TF,1)) {
         if(TimeToStr(TimeCurrent(),TIME_MINUTES)==tim) { Print("MA: "+iMA(NULL,TF,baseperiod,0,MODE_EMA,PRICE_CLOSE,1)); }
         ZZ=iTime(NULL,TF,1); }}
 
aicccia:
But if you look at the Print() function for the same exact time, it gives a value of 1.66074.

iMA(NULL,TF,baseperiod,0,MODE_EMA,PRICE_CLOSE,1)=>01.30
iMA(NULL,TF,baseperiod,0,MODE_EMA,PRICE_CLOSE,0)=>01.35
 
That plus the indicator is 1296 and you're using
extern int baseperiod=1200; 
Reason: