[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 273

 
Dikii:

Explain how to find out the Bid 10 seconds ago, preferably in code.

I don't need it, so I'm not interested in how to do it. Search for it, maybe you'll find something! Good luck!
 
gince:

There is one division. And the CMM function (although it is full) says that there is not enough data in the resulting array in the function. I can't figure out why. Because of this I get division by zero.
I've been sitting in the same place for days now and can't find the error
 
gince:
I've been sitting in the same place for days now and can't find the error


which line exactly, where is the division by 0? and at which value of the index
 

this function ArrayChLR(C, y, max) gives an error ---ArrayChLR(): Not enough row elements! n=0 ----.

void ArrayChLR(double& x[], double& y[], double& max) {
  double a, b, c, sx=0, sx2=0, sxy=0, sy=0;
  int    i, n=ArraySize(x);

  if (n>1) {
    for (i=0; i<n; i++) {
      sx+=i+1;
      sy+=x[i];
      sxy+=(i+1)*x[i];
      sx2+=(i+1)*(i+1);
    }
    a=sx*sy-n*sxy;
    c=sx*sx-n*sx2;
    if (c!=0) a=a/c; else a=0;
    b=(sy-a*sx)/n;
    ArrayResize(y, n);
    max = 0; 
    double dif[];
    ArrayResize(dif, n);
    for (i=0; i<n; i++) 
    {
      y[i]=a*(i+1)+b;
      dif[i] = MathAbs(Close[i] - y[i]);
      if(dif[i] > max) max = dif[i];      
    }
  } else Print("ArrayLR(): едостаточное количество элементов ряда n=", n);
}

So then s array is empty and its elements are empty.

2013.04.08 16:57:03 2013.03.29 20:45 naktinis fletas EURUSD,M15: zero divide
2013.04.08 16:57:03 2013.03.29 20:45 naktinis fletas EURUSD,M15: ArrayLR():not enough elements in the array! n=0

 

More questions

What is the best or correct time filter?

like this

extern int     startHourFlatMA        =  16;    
extern int     startMinFlatMA        =  00;

int start(){
if(Hour() >= startHourFlatMA && Minute() >= startMinFlatMA)
.
.
.
retorn
}

or

extern string  startstartFlatMA       = "16:00";
extern string  endstartFlatMA       = "00:00";

int start(){
if(TimeCurrent()>= StrToTime(startstartFlatMA) && TimeCurrent()<= StrToTime(endstartFlatMA)+24*60*60)
.
.
.
return
}
 
Can you please tell me, among closed orders OrderSelect() starts checking from where, from the end or from the beginning? Well, or from 0 or whatever...?
 
CYBOPOB:
Can you please tell me, among closed orders OrderSelect() starts checking from where, from the end or from the beginning? Well, or from 0 or whatever...?

If you set the loop, that's where it starts from. Read carefully the description of this function in F1 in ME editor.
 

Good day.

Could you please tell me if mql4 allows the indicator to draw a horizontal line on the other chart (not on the one it is hovering on)?

 
Roman.:

If you set the loop, that is where it will come from. Read carefully the description of this f-fi through F1 in MU editor.


Well, if it was written in human language ... So in any endeavor, first it seems that everything is clear, but a little later you start to go crazy ...))

O.K. A concrete example:


The order is closed at the end of the TP movement, but since the SELL signal has not been cancelled a new order is opened, which is unacceptable.

I measure 720 sec, after which we can open a new order. So, in this case, from which order these seconds will be measured, from the first order in the history or from the last one?

And then: And if so, what then? Since I plus z, it comes out to count from the beginning? Brrrrr:))


Thank you very much!

 

?Found the mistake.

int start()
 {
   double volMA11, volMA12, volMA21, volMA22;  
   double x[], y[]; 
   
   Print("******************STARTAS*****************************************");
   
   if(!TF_F_NewBar())return(0);
 
   volMA11 = iCustom(NULL, 15, "volumeMA",  2, 1);         
   volMA12 = iCustom(NULL, 15, "volumeMA",  2, 2);
   volMA21 = iCustom(NULL, 15, "volumeMA",  3, 1);
   volMA22 = iCustom(NULL, 15, "volumeMA",  3, 2);
    
   if(DayOfWeek()==1 || DayOfWeek()==2 || DayOfWeek()==3 || DayOfWeek()==4)                             //jei pirmadienis antradienis ar treciadienis, ar ketvirtadienis
   {         
      if(TimeCurrent()>= StrToTime(startstartFlatMA) && TimeCurrent()<= StrToTime(endstartFlatMA)+24*60*60)
      {
         //Print("fleto starto ieskojimo laikas prasidejo  "+TimeToStr(TimeCurrent())+" >= "+TimeToStr(StrToTime(startstartFlatMA))+
               //"  &&  "+TimeToStr(TimeCurrent())+" <= "+TimeToStr(StrToTime(endstartFlatMA)+24*60*60));
         bool laikas = true;
         Print("laikas = "+laikas);         
         if(volMA21 - volMA11 > 0 && volMA12 - volMA22 > 0)
         {                                                                                   //jei buvo susikirtimas
            susikirtimas = true;           
         }
         if(susikirtimas == true) 
         {
            if(zvakes_pabaiga)
            {
               if(iTime(NULL, BarEnd, 1)!= LastTime)
               {            
                  LastTime = iTime(NULL, BarEnd, 1);
                  flat = true;           
                  LastTime = iTime(NULL, BarEnd, 1);
              }
              else return(0);            
           }
           else flat = true;
           if(flat == true)
           {
               i++; 
             //Zinodami indekso eiles numeri galim keisti masyvo ilgi
            
            ArrayResize(avgPriceH,i); 
            ArrayResize(avgPriceL,i);
            ArrayResize(avgPriceO,i); 
            ArrayResize(avgPriceC,i);        
           Print("ArraySize     "+ArraySize(avgPriceC));
            //jei fletas prasidejo renkam duomenis i masyva zvakiu HL ir OC skaiciavimui
            
            avgPriceH[i] = High[1];    
            avgPriceL[i] = Low[1];     
            avgPriceO[i] = Open[1];   
            avgPriceC[i] = Close[1];
         
            j++; 
            
            ArrayResize(chPriceC,j); 
            ArrayResize(chTime,j);    
           } 
         for(int a=0; a<=i; a++)Print("avgPriceC["+a+"]="+avgPriceC[a]);
         
        }        
     }
  }
    
  return(0);
}

These pages print zeros. WHY ?

2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[21]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[20]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[19]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[18]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[17]=0.00000000

.

.

.
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[2]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[1]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: avgPriceC[0]=0.00000000
2013.04.08 19:06:05 2013.03.28 20:00 testavimas naktini fleta EURUSD,M15: ArraySize 21

Reason: