Download MetaTrader 5
To add comments, please log in or register
Do you have questions on how to turn your idea into reality? Ask them on the Forum!
Erman Ardianto
572
Erman Ardianto 2016.01.29 10:44 
Hi all,

I'm on a verge of bilding multi pairs EA and I found some problem.

I've try to trace the problem and checking some codes but I'm, stuck on this.

Is anybody know why ma1 and ma2 are resulting different?


   int MAPeriod=100;
   int MAMethod=0;

   double clos[500];
   for(int k=0;k<500;k++)
   {
      clos[k]=Close[k];
   }
   
   double ma1=iMAOnArray(clos,0,MAPeriod,0,MAMethod,1);
   double ma2=iMA(Symbol(),0,MAPeriod,0,MAMethod,PRICE_CLOSE,1);


Thanks for your help

honest_knave
Moderator
1800
honest_knave 2016.01.29 11:40  
devilian1899:
Hi all,

I'm on a verge of bilding multi pairs EA and I found some problem.

I've try to trace the problem and checking some codes but I'm, stuck on this.

Is anybody know why ma1 and ma2 are resulting different?



Thanks for your help



   int MAPeriod=100;
   int MAMethod=0;

   double clos[500];
   ArraySetAsSeries(clos,true);

   for(int k=0;k<500;k++)
   {
      clos[k]=Close[k];
   }
   
   double ma1=iMAOnArray(clos,0,MAPeriod,0,MAMethod,1);
   double ma2=iMA(Symbol(),0,MAPeriod,0,MAMethod,PRICE_CLOSE,1);
whroeder1
14201
whroeder1 2016.01.29 14:37  
Without the array being AsSeries, you are asking for the MA(1) so the MAoa only has clos[0] and clos[1] to work with.
Erman Ardianto
572
Erman Ardianto 2016.01.29 15:54  
Oh thank you.. forgot to add that part.
honest_knave:


I see, thanks.

WHRoeder:
Without the array being AsSeries, you are asking for the MA(1) so the MAoa only has clos[0] and clos[1] to work with.
/
To add comments, please log in or register