A question for MQL experts - page 6

 

Like this? - Instead of

int getNextOrderNum(int RRRR) {
   switch (RRRR) {
   case 101:
      return (102);
                  }
   return (0);
}

Please tell me what to set here:

(for Magic_101, Magic_102)

int getNextOrderNum(int RRRR) {
  ..... ?... ... ?
   return (0);
}

 

Andrei, it's clear that it won't compile. Maybe you could just set the task differently? And, as it seems to me, in this case everything is quite transparent.

To use (correct in the code) labels in the ints, and that's it... I don't understand why all the fuss and wheezing for help...)))

 

Maybe, I can't say without the code. It can probably be done in a simpler way.

Rita:

Please tell me what to set here:

{
   if (RRRR == 101)
   {
      return (102);
   }
   else if (RRRR == 102)
   {
      return (103);
   }
   //...
}

Here is another problem - with each new condition nesting level increases, and its level is limited, i.e. at nesting level around 20 (I do not remember exactly) the code will stop compiling again.

I have an alternative suggestion - repeat the question here with more detailed code, it's probably possible to make it much more transparent and simpler.

 

No other, not restricted

   if (RRRR == 101){
      return (102);
   }
   if (RRRR == 102){
      return (103);
   }
   //...
 
return(RRRR+1)
 
Maybe just a function that increases the magik by one. The example seems to need this. Although the last Integer example is just that
 
Integer:

No other, not restricted

100%. This is the solution we need to stop at. No tails or snot, all modification is strictly limited to the former switch.
 

Good evening, everyone.

So I still don't quite understand. I need to replace the magics in the EA code (there are about 20 of them), given by numbers. I was asked to put the magik into global variables. I did it.

Magic_101=Magic+1;
Magic_102=Magic+2;
Magic_103=Magic+3; .......

Did I understand Integer's suggestion correctly?

Instead of the function code in which the magicians are specified as numbers:

int getNextOrderNum(int Магик) {
   switch (Магик) {
   case 101:
      return (102);
   case 102:
      return (103);
   
      }
   return (0);
}

Would it be correct to set it like this ? -

int getNextOrderNum(int Магик) {
   if (Магик == Magic_101)    {  return (Magic_102);}
   if (Магик == Magic_102)    {  return (Magic_103); }
    
                return (0);
                              }
 
Rita:

Good evening, everyone.

So I still don't quite understand. I need to replace the magics in the EA code (there are about 20 of them), given by numbers. I was asked to put the magik into global variables. I did.

Magic_101=Magic*1;
Magic_102=Magic*2;
Magic_103=Magic*3; .......

Did I get the suggestion from Integer right?

Instead of the function code in which the magicians are set as numbers:

Would it be correct to set it like this ? -


int getNextOrderNum(int Магик) {
   int Res=Магик+1;
   if (Res>MagicMax) Res=MagicMin;

   return (Res);
}
 
Thank you, Victor. I'll give it a try.