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.
http://fiat-luxx.com/trading/problem.jpg
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.
Inserted Code
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); }}
http://fiat-luxx.com/trading/problem.jpg
Attached File(s)
Test.mq4
< 1 KB
|
290 downloads