[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 75

 
MikeM:
Put a closing parenthesis after the profit and a semicolon after it. The rest is scrap.

MAGIC - screw it.
 

Magic and slip are not that important, as normal orders go without them.

double PriceBuy = iHigh(Symbol(),60, 1); 

OrderSend(Symbol(), OP_BUYSTOP, Lot, PriceBuy, StopLoss, TakeProfit, "Order", 0, Green); 


 

The compiler thinks that"Order" isthe value oftakeprofitparameter, and it should be of double type.

takeprofit should be the seventh parameter, but it is the sixth, because slippage is missing.

This is the problem.

 
silhouette:
Thank you! I understand the logic. But how can it be fixed?


I've redone it. Seems to be technically correct, but looks a bit Hindu.

int Orders(int magic)
 {
  int ordrs;
  for(ordrs=0; ordrs<=OrdersTotal(); ordrs++)
   {
    if(OrderSelect(ordrs, SELECT_BY_POS)==true)
     {
      if(OrderMagicNumber()==magic)
       {
        return(1);
       }
     }
   }
 } 

   OM1=Orders(ExpertID1);
   OM2=Orders(ExpertID2);
   if(OM1!=1)
    {
     Type1=true;
    }
   else 
    {
     Type1=false;
    }
   if(OM2!=1)
    {
     Type2=true;
    }
   else
    {
     Type2=false;
    }
 
silhouette:


Reworked. Seems to be technically correct, but looks a bit Hindu.

Better like this:
bool  Orders(int magic)
 {
  int ordrs;
  for(ordrs=0; ordrs<OrdersTotal(); ordrs++)
   {
    if(OrderSelect(ordrs, SELECT_BY_POS)==true)
     {
      if(OrderMagicNumber()==magic)
       {
        return(true); // раз нашли, то и хватит, дальше смотреть не надо
       }
     }
   }
  return(false); // все просмотрели и не нашли
 } 
 
ilunga:
it's better this way:

Exactly! Thank you for your help.
 
ilunga:
it's better this way:
for(ordrs=0; ordrs < OrdersTotal(); ordrs++)
Just less, not less or equal.
 
artmedia70:
Just less, not less or equal.


Yes, that's right. I was copying and didn't pay attention to that place
 

Hi all! As the topic is for newbies help:

Variable name in the board to change, so that in MT4 the name is different and the file itself will change! Thanks

 
Versig:

Hi all! As the topic is for newbies help:

Variable name in the board to change, so that in MT4 the name is different and the file itself will change! Thanks

Change the name, of course! Tell us about the result later.