expert advisor - miscellaneous questions - page 39

 
Marco vd Heijden:

Because externally declared parameters can not be altered, or changed i always copy the external parameter and then change the copy.
Also extern is obsolete, use

I got it. I remember now I could use same method like Stop Loss value. I will try it.

Thanks a lot for your reply.

 
#Move Object - ReClosed
 

#Multiple Orders Close - Open

I try to close all open orders at once but sometimes few orders still opens and needs to try one more again.
Q:  Is it normal, please?

Thanks in advance.

 
  1. In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading)
 
whroeder1:
  1. In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading)

Need to read more carefully, thank you so much!
 

Need to share that part of my code with you that it will help me to clarify my concern.
( my close order function almost same with them )

Q:  Is that part of code wrong, please?
      And what I missed, please?

Thanks in advance.

void closeorders()
  {
   for(positionindex=OrdersTotal()-1; positionindex>=0; positionindex--)
     {
      if(!OrderSelect(positionindex,SELECT_BY_POS,MODE_TRADES)) continue;
      if(closeallsymbols==false && OrderSymbol()!=Symbol()) continue;
      if(OrderMagicNumber()==magicnumber && (OrderType()==OP_BUY || OrderType()==OP_SELL))
        {
         if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,CLR_NONE))
           {
            Print("failed #",OrderTicket()," error: ",GetLastError());
           }
        }
     }
//---
   return;
  }
 

Did you get any errorcode?

 
Marco vd Heijden:

Did you get any errorcode?


Not at all.

 

And you want it to close any order except for the chart symbol order ?

And with the correct magicnumber?

Then it will do.
 
Marco vd Heijden:

And you want it to close any order except for the chart symbol order ?

And with the correct magicnumber?


No, I need to close all chart symbol orders.
Yes, with correct magicnumber.

Reason: