i write some code in my ea,but my EA is very slowly,why

 
    int i;
                        int  x;
                        double BBI[];
                        ArrayResize(BBI,20);
                        double sum;
                        double std;
                        double upr;
                        double dnr;
                        double mid;
                        double uper;
                        double dner;
                        double ave;
                        double dzq[];
                        double  dzq1;
                        ArrayResize(dzq,20);
                        BBI[1]=0;
                        dzq[1]=0;
                        for(x=1;x<=统计周期;x++)
                           {
                              double mapra1=iMA(Symbol(),0,MAperiod1,ma_shift,ma_method,ma_applied_price,x);
                              double mapra2=iMA(Symbol(),0,MAperiod2,ma_shift,ma_method,ma_applied_price,x);
                              double mapra3=iMA(Symbol(),0,MAperiod3,ma_shift,ma_method,ma_applied_price,x);
                              double mapra4=iMA(Symbol(),0,MAperiod4,ma_shift,ma_method,ma_applied_price,x);
                              double BBIC=((mapra1+mapra2+mapra3+mapra4)/4);
                              BBI[i+x]=BBIC;
                           }
                        
                       for(x=1;x<=统计周期;x++)
                           {
                             sum+=BBI[i+x];
                           }
                          ave=sum/(统计周期-1);
                                 for(x=1;x<=统计周期;x++)
                                    {
                                         dzq[x]=MathPow(BBI[x]-ave,2);
                                    }
                          for(x=1;x<=统计周期;x++)
                           {
                              dzq1+=dzq[i+x];
                           }
                        double  temp_one=NormalizeDouble(dzq1/(统计周期-1),Digits);
                        std=MathSqrt(temp_one);
                        upr=BBI[1]+3*std;
                        dnr=BBI[1]-3*std;
                        mid=iMA(Symbol(),0,mid_period,ma_shift,ma_method,ma_applied_price,i);
                        double temp_stddev1=iStdDev(Symbol(),0,MAperiod4,ma_shift,ma_method,ma_applied_price,i);
                        uper=mid+2*temp_stddev1;
                        dner=mid-2*temp_stddev1;
                        int ding1=100,di1=100,ding2=100,di2=100;
                        if((Close[1]>uper)&&(Close[1]<upr))  {ding1=1;}
                        if((Close[1]<dner)&&(Close[1]>dnr))   {di1=1;}
                        // if(ding1==1) Alert("ding1==1");
                        // if(di1==1) Alert("d1==1");
if the EA run,will detect all array display to main window?
 

Does that compile?

Shouldn't you be putting some values in the iMA call?

double mapra1=iMA(Symbol(),0,MAperiod1,ma_shift,ma_method,ma_applied_price,x);

and you should use NULL, not Symbol()

 
zdj231:
if the EA run,will detect all array display to main window?
Please do not double post ! https://www.mql5.com/en/forum/146186
 
GumRai:

Does that compile?

Shouldn't you be putting some values in the iMA call?

double mapra1=iMA(Symbol(),0,MAperiod1,ma_shift,ma_method,ma_applied_price,x);

and you should use NULL, not Symbol()


Symbol() is OK!!
 
zdj231:
if the EA run,will detect all array display to main window?
Are you running this for each tick ? or once per bar ?
 
 for(x=1;x<=统计周期;x++)
                           {
                              double mapra1=iMA(Symbol(),0,MAperiod1,ma_shift,ma_method,ma_applied_price,x);
                              double mapra2=iMA(Symbol(),0,MAperiod2,ma_shift,ma_method,ma_applied_price,x);
                              double mapra3=iMA(Symbol(),0,MAperiod3,ma_shift,ma_method,ma_applied_price,x);
                              double mapra4=iMA(Symbol(),0,MAperiod4,ma_shift,ma_method,ma_applied_price,x);
                              double BBIC=((mapra1+mapra2+mapra3+mapra4)/4);
                              BBI[i+x]=BBIC;
                           }

Your x is atleast 1, so why do you calculate this every tick same bar ??

 
deVries:

Your x is atleast 1, so why do you calculate this every tick same bar ??


the,MAperiod1 is not same
 
RaptorUK:
Are you running this for each tick ? or once per bar ?


I just need the last one K line 's VALUE,not need every line
 
zdj231:

I just need the last one K line 's VALUE,not need every line
RaptorUK:
Are you running this for each tick ? or once per bar ?

Perhaps you could answer the question ?
Reason: