Download MetaTrader 5

a Serious BUG!

To add comments, please log in or register
sarged
66
sarged  
double myarray[];
   if (poss<0)
      {
      int count=0;
      //Alert("Copying");
         switch (bla)
             {
             case 1:
              // count = CopyHigh(symbol, PERIOD_M1, sdate, TimeCurrent(),myarray);
             break;
             case 2:
               count = CopyLow(symbol, PERIOD_M1, sdate, TimeCurrent() ,myarray);
              break;
             case 3:
               count = CopyOpen(symbol, PERIOD_M1, sdate,1,myarray);
              break;
             }

      if (count>0)
         {
         Alert(count);
                         raetzor=myarray[0];
             switch (bla)
                {
                case 1:
                for (int zzz=0;zzz<count;zzz++)
                {
                   
                      if (raetzor<myarray[zzz])
                      {
                      raetzor= myarray[zzz];
                      }
                }
                break;
                case 2:
                for (int zzz=0;zzz<count;zzz++)
                {
                     wtf=myarray[zzz];

                      if (raetzor>wtf)
                      {
                     

----------------------------------------------------------------

                      raetzor= myarray[zzz];
                      }
                }
                                    Alert(raetzor);
                break;
                case 3:
                      raetzor= myarray[0];
                break;
                }
               
         raetzor= myarray[ArrayMaximum(myarray,0,WHOLE_ARRAY)];
         add(theid,raetzor);
        
         }
      else
         {
         return 0;
         }
      }
   else
      {
      raetzor=containzamassiv[poss].value;
         switch (bla)
             {
             case 1:
                CopyHigh(symbol, PERIOD_M1, 0, 1,myarray);
                if (myarray[0]>raetzor)
                   {
                      raetzor=myarray[0];
                      containzamassiv[poss].value=raetzor;
                   };
             break;
             case 2:
                CopyLow(symbol, PERIOD_M1, 0, 1,myarray);
                if (myarray[0]<raetzor)
                   {
                      raetzor=myarray[0];
                      containzamassiv[poss].value=raetzor;
                   };
             break;
             case 3:
                //отдыхаем
             break;
             }
       
      };

return kakarates::raetzor;

};






IF i compare directly raetzor and myarray[zzz] the IF condition will not execute; The comparison will not work; As well as if use ArrayMimum function, it doesn't work!!


So i was getting lowest value bigger than the opening. Im very disappointed, it took me hours away1!  to spot this.

Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы - Документация по MQL5
Rashid Umarov
Admin
12067
Rashid Umarov  
Please, insert code properly.
MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
sarged
66
sarged  

Oke, sorry I didn't realize I pasted only a part of it. Here it is:



class kakarates
{
public:
double GetShit(string,datetime,int );
kakarates()
   {
   }
};

double kakarates::GetShit(string symbol,datetime sdate, int bla)
{
string theid,type;
double raetzor=-1;
double wtf=-1;
int poss;
switch (bla)
  {
   case 1:
     type="High";
     break;
   case 2:
     type="Low";
     break;
   case 3:
     type="Open";
     break;
  }
theid=symbol+TimeToString(sdate)+type;
poss=check(theid);
int amount=0;
double myarray[];
   if (poss<0)
      {
      int count=0;
         switch (bla)
             {
             case 1:
               count = CopyHigh(symbol, PERIOD_M1, sdate, TimeCurrent(),myarray);
             break;
             case 2:
               count = CopyLow(symbol, PERIOD_M1, sdate, TimeCurrent() ,myarray);
              break;
             case 3:
               count = CopyOpen(symbol, PERIOD_M1, sdate,1,myarray);
              break;
             }
      if (count>0)
         {
         raetzor=myarray[0];
             switch (bla)
                {
                case 1:
                for (int zzz=0;zzz<count;zzz++)
                {
                      if (raetzor<myarray[zzz])
                      {
                      raetzor= myarray[zzz];
                      }
                }
                break;
                case 2:
                // Ok. It doesnt work.
                // So as this: raetzor=ArrayMinimum(myarray,WHOLE_ARRAY);
                for (int zzz=0;zzz<count;zzz++)
                {
                      if (raetzor>myarray[zzz])
                      {
                      raetzor= myarray[zzz];
                      }
                }
                break;
                case 3:
                      raetzor= myarray[0];
                break;
                }
         raetzor= myarray[ArrayMaximum(myarray,0,WHOLE_ARRAY)];
         add(theid,raetzor);
         }
      else
         {
         return 0;
         }
      }
   else
      {
      raetzor=containzamassiv[poss].value;
         switch (bla)
             {
             case 1:
                CopyHigh(symbol, PERIOD_M1, 0, 1,myarray);
                if (myarray[0]>raetzor)
                   {
                      raetzor=myarray[0];
                      containzamassiv[poss].value=raetzor;
                   };
             break;
             case 2:
                CopyLow(symbol, PERIOD_M1, 0, 1,myarray);
                if (myarray[0]<raetzor)
                   {
                      raetzor=myarray[0];
                      containzamassiv[poss].value=raetzor;
                   };
             break;
             case 3:
                //отдыхаем
             break;
             }
      };
return kakarates::raetzor;

};




To the function the time, the symbol and the mode are passed. It should calculate the Maximum and Minimum since the specified date, and also pass the Open price. Then it will store these values and then it will be checking and updating it if necessary.


So, we can see the Copy* commands fill out the array thoughroughtly, and the count is over hunders, but its all being useless.



Thanks.

Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы - Документация по MQL5
sarged
66
sarged  

whoops, Actually I'm retarded! I missed the line after switch when it gets it back to maximum again. Sorry for disturbance...
To add comments, please log in or register