800EMA calculating incorrectly in EA

 

Hi,

I am experiencing a very weird 800 EMA miscalculation in my EA.

I make use of the following EMA's: 10,30,50,100,200 and 800.. and use the following code to calculate them: iMA(NULL,0,xxx,0,MODE_EMA,PRICE_CLOSE,1) where xxx = 10,30,50,100,200 or 800. Using the Comment function in a custom indicator and applying the same code, I have confirmed that the chart EMA's are correctly calculated. However, when applied in my EA the 800EMA iMA calculation is giving me an incorrect value. I have tested my EA with a Print statement and confirmed that the 10, 30, 50, 100 and 200 EMA's are all calculating correctly, but only the 800EMA is incorrect. Even more stranglely, if I calculate an 800SMA in my EA, then it calculates correctly? i have also tested with a larger 1200EMA and the calculation is also incorrect. I am also testing for today (21/10/2013) so I know I have enough data... Comment(Bars) = 37335 on my charts.

Does anyone know why this would be? Is this a limitation with the strategy Tester?


Regards,

Sonipipster

 
  1. Tester only give you an initial 100-1000 bars depending on when you start and available history.
  2. SMA(n) requires n bars. EMA(n) requires 3.45*(n+1) bars
 
WHRoeder:
  1. Tester only give you an initial 100-1000 bars depending on when you start and available history.
  2. SMA(n) requires n bars. EMA(n) requires 3.45*(n+1) bars

Thanks for the reply. Can I then assume that it will work fine in live trading?
 
sonipipster:

Thanks for the reply. Can I then assume that it will work fine in live trading?


depends on the available history,

but you can check it using Print, Comment or Allert giving the results

Reason: