Download MetaTrader 5

Something with iMAOnArray

To add comments, please log in or register
Erman Ardianto
1141
Erman Ardianto  
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
2324
honest_knave  
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
16071
whroeder1  
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
1141
Erman Ardianto  
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