Download MetaTrader 5
To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
Eukalibis
10
Eukalibis 2014.08.22 18:42 

Good evening, 

I haven't coding for a while and I started again a few weeks ago. I've noticed that my EA wasn't working as he was before build 600.

I investigate and I found that the function iMAOnArray didn't give me the same result before the build 509 and after 600+. I've tried the same "code example" on the 2 build (509 and 670)

 

double array0[], array1[];


//+------------------------------------------------------------------+
int init()
  {
   Alert("Lancement du programme"); 
   ArrayResize(array0, 101); ArraySetAsSeries(array0, true);
   ArrayResize(array1, 101); ArraySetAsSeries(array1, true);
   
   return(0);
  }

int start()
  {
  
  
   for (int i = 100; i >= 0; i--) array0[i] = iMA(NULL, 0, 2, 0, MODE_LWMA, PRICE_CLOSE, i);
   
   Alert("array0 = ",array0[0]);
   Alert("array0 = ",array0[1]);
   Alert("array0 = ",array0[2]);
   Alert("array0 = ",array0[3]);

   array1[0] = iMAOnArray(array0, 0, 2, 0, MODE_LWMA, 0);
   array1[1] = iMAOnArray(array0, 0, 2, 0, MODE_LWMA, 1);
   array1[2] = iMAOnArray(array0, 0, 2, 0, MODE_LWMA, 2);
   array1[3] = iMAOnArray(array0, 0, 2, 0, MODE_LWMA, 3);
      
   
   Alert("array1-- 10 = ",array1[0]);
   Alert("array1-- 11 = ",array1[1]);
   Alert("array1-- 12 = ",array1[2]);
   Alert("array1-- 13 = ",array1[3]);
  
   return(0);
  }

 


Then I Backtested from 2014.08.11 --> 2014.08.16 (M5)

 

Result in 509:

20:31:41 TestGenerator: current spread 19 used

20:31:41 testiMAOnArray509 test started

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: Lancement du programme

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3408

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.341

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3412

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3415

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array1-- 10 = 1.3409

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array1-- 11 = 1.3411

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array1-- 12 = 1.3413

20:31:41 2014.08.11 00:00  testiMAOnArray509 EURUSD,M5: Alert: array1-- 13 = 1.3415

....

 20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3397

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3398

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3397

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array0 = 1.3396

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array1-- 10 = 1.3397

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array1-- 11 = 1.3398

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array1-- 12 = 1.3397

20:31:46 2014.08.15 23:59  testiMAOnArray509 EURUSD,M5: Alert: array1-- 13 = 1.3396

 

 

Result in 670:

20:28:05 TestGenerator: current spread 19 used

20:28:05 TestIMAOnArray600 test started

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: Lancement du programme

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3408

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.341

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3412

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3415

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 10 = 1.3409

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 11 = 1.3411

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 12 = 1.3413

20:28:05 2014.08.11 00:00  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 13 = 1.3415

...

 20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3397

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3398

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3397

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array0 = 1.3396

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 10 = 1.3397

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 11 = 1.3398

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 12 = 1.3413

20:28:12 2014.08.15 23:59  TestIMAOnArray600 EURUSD,M5: Alert: array1-- 13 = 1.3415

 

 

 Unfortunately I don't found the same result. Can somebody explain me what I am doing wrong or what do I not understand ? 

 I thank you in advance. 

/
To add comments, please log in or register