[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 364

 
I checked this code now on a real account, everything is OK, I modified all market orders, but the only thing I haven't touched is the pending orders. What's the problem? What do you think?
 
Noterday:
I checked this code on my real account, everything is ok, I modified all market orders, but I left the pending orders untouched. What's the problem? What do you think?


In the condition

         if(cmd==OP_BUY || cmd==OP_SELL)

and in the condition

if(cmd==OP_BUY)
 
I don't get it :(
 
Noterday:
I don't get it :(

There's also a phrase in the script's name that says market orders only... Remove those conditions for market orders, then conditions for market and pending orders will be met - that's all. No that's not all - read it carefully - requirements and limitations... ...and make sure you add these minimum requirements to your pending orders so they are met as well.
 
KONDOR:


So I have no such strings at all, I don't select the type AT ALL, but modify ALL the ones I have, whether it's a pending or a market one.
 
Noterday:
So I have no such lines at all, I don't select type AT ALL, I modify ALL of them, be it pending or market.

I am writing you to carefully read: " FreezeLevel distance restriction.

Market orders are not closed if StopLoss or TakeProfit values violate FreezeLevel parameter requirements.
StopLoss or TakeProfit market orders can not be modified if StopLoss or TakeProfit values violate the StopLevel parameter requirements.
Deletion and modification of pending orders are not performed if the declared open price of the order violates the FreezeLevel parameter requirements.
 

That's it, the error was there:

if (OrdersTotal()!=0)
  {
   
   bool   modify;
   int    Done=0;
   for (i = 1; i <= OrdersTotal(); i++)
      {
       if (OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES) == true)
         {
          Stop = OrderStopLoss();
          Take = OrderTakeProfit();
          Print("Пробую модифицировать ",i," ордер (#",OrderTicket(),")");
          modify = OrderModify(OrderTicket(),0,SL,TP,0,0);                          <<<--------------------- во втором параметре OrderModify нужно ставить не ноль а Orderopenprice()
          if (modify==true) Done++;
          if (modify==false)
            {
             int error = GetLastError();
             Print("                 Неудача... Ошибка ",error);
             Sleep(5000);
            }
         }
       }
    Alert("Модифицировано  ",Done,"  из  ",OrdersTotal());
    Sleep(10000);
   }
 
Noterday:
So I have no such lines at all, I don't select type AT ALL, I modify ALL of them, be it pending or market.


Also in the condition this

( cmd==OP_BUYLIMIT || cmd==OP_SELLSTOP)

change similarly under the order to be selected (change the order type definition condition to one of these:

Constant Value Description
OP_BUY 0 Buying position.
OP_SELL 1 Selling position.
OP_BUYLIMIT 2 Buy limit pending position.
OP_SELLLIMIT 3 Sell limit pending position.
OP_BUYSTOP 4 Buy stop pending position.
OP_SELLSTOP 5 Sell stop pending position.
and already then you check for compliance with "Trading Requirements and Restrictions" of this or that selected order, each type of selected order has its own requirements and restrictions... and here the script is only for market orders... Edit by analogy and that's it - you have all the information. Calmly, carefully and methodically.

 
Yes everything was originally written correctly, the mistake was in the above stuff. THANK YOU ALL! =)))
 
Is it possible to speed up the testing process?