OrderModify.... I want to modify all my orders at once.

 
                                if(TrailingstopUse == true && Trailingstop > 0 && open_buy > 1 ) {
                                        if(Bid-AvgPrice>Trailingstep*PointDigit) {
                                        if(OrderStopLoss() < Bid - (TrailingSinglestop+TrailingSinglestep-1)*PointDigit) {
                                                OrderModify(OrderTicket(),OrderOpenPrice(),Bid - (Trailingstop)*PointDigit, OrderTakeProfit(), 0, MediumSeaGreen);
                                        }
                                        }
                                }

                        }

AS you can see,,I have tried to emulate that If # of orders are greater than 1, it calculates its avgprice base on lot size and modify orders at once.

But, it just modifies the last order's stoploss figure. this can have any effect on other orders except the last one.

Could anyone help me?

You don't have to code everything,,, just any references or explanation would help too.

Please EDUCATE me.

 

u have to select each order to do that

   for (int i = OrdersTotal() - 1; i >= 0; i--)
      {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      
      if (TrailingstopUse.........)
         {
         ..
         ..
         }
      }

it's not possible to do this at once

 

And some more things......

The orders will be modified one by one...... You can't change all at once with one command

All orders does also mean different Symbols() they don't have same Bid and Ask price....

So for trailing use select symbol and magicnumber also

 

Thanks a lot guys...

My ea has now a little bit longer code, but it works,,

Reason: