Something with iMAOnArray

Back to topics list To post a new topic, please log in or register
avatar
288
devilian1899 2016.01.29 11: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



avatar
735
honest_knave 2016.01.29 12: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);

avatar
12985
WHRoeder 2016.01.29 15: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.
avatar
288
devilian1899 2016.01.29 16: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.
Back to topics list  

To add comments, please log in or register