Pending order didn't change to Open - only after client terminal reset (ERR_INVALID_TRADE_PARAMETERS)

 

Hey Ya'all,

I have a Pending Order (i.e. BuyLimit), the market has changed and it did not change to Open

When I try to delete the Pending Order I get ERR_INVALID_TRADE_PARAMETERS

But... if I reset the client, the order is shown as BUY OPEN.

Has anyone encountered such a problem?

Thanks

 

You haven't shown any code so I can only make assumptions/guesses . . . . or just ignore your post.

My guess is that you don't check the OrderType before you attempt to delete it . . you assume it is still a pending order . . .

Perhaps you can show an extract from the logs and/or some code . . .

 
Possible conditions with any code :

1-. "it did not change to Open", Order was executed -> "it did change to Open but terminal was blocked by other unfinished task-s and didn't show changes", maybe loops cause.

2-. ...missing code...or wrong order selected...

3-. "... reset the client,... BUY OPEN", - it gets fresh info imported and shown.
 
RaptorUK:

You haven't shown any code so I can only make assumptions/guesses . . . . or just ignore your post.

My guess is that you don't check the OrderType before you attempt to delete it . . you assume it is still a pending order . . .

Perhaps you can show an extract from the logs and/or some code . . .


Thanks for the reply, Here is my Code:

#include <stdlib.mqh>
int start()
{
  int total = OrdersTotal();
  
   for(int i=0;i<total;i++)
   {
      if (OrderSelect(i,SELECT_BY_POS) == true)
      {
         if (OrderCloseTime() <= 0)
         {
            int type = OrderType();
            if ( (type == OP_BUY) || (type == OP_SELL) )
            {
               Print("Ticket="+OrderTicket()+", Status=OPEN");
            }
            else
            {
               Print("Ticket="+OrderTicket()+", Status=PENDING");
               
               if (OrderDelete(OrderTicket())==false)
                  Print("Failed to delete Pending Ticket. Error="+ErrorDescription(GetLastError()));
            }
         }
      }   
   }
   return (1);
}

I'm trying to reproduce the problem and post the Journal & Experts Log as well, along with some screenshot.

So I've checked the OrderType() in the original Code as you suggested and I found it as Pending. The Trader Client User-Interface shows it as Pending as well.

 
JamesMadden:


Thanks for the reply, Here is my Code:

I'm trying to reproduce the problem and post the Journal & Experts Log as well, along with some screenshot.

So I've checked the OrderType() in the original Code as you suggested and I found it as Pending. The Trader Client User-Interface shows it as Pending as well.

First obvious thing you are doing wrong: Loops and Closing or Deleting Orders your loop is actually wrong in 2 ways . . . read the thread it will help you.
 
JamesMadden:

Hey Ya'all,

I have a Pending Order (i.e. BuyLimit), the market has changed and it did not change to Open

When I try to delete the Pending Order I get ERR_INVALID_TRADE_PARAMETERS

But... if I reset the client, the order is shown as BUY OPEN.

Has anyone encountered such a problem?

Thanks

So you have this in your expert journal log ...

Ticket=123456 Status=PENDING

Failed to delete Pending Ticket. Error=ERR_INVALID_TRADE_PARAMETERS

What's the broker and what's the OS ?

 
onewithzachy:

So you have this in your expert journal log ...

Ticket=123456 Status=PENDING

Failed to delete Pending Ticket. Error=ERR_INVALID_TRADE_PARAMETERS

What's the broker and what's the OS ?

Yes, This is what I get,

Tried it with two different traders: FXCM & FxCentral both running Windows 7.

 
JamesMadden:

Yes, This is what I get,

Tried it with two different traders: FXCM & FxCentral both running Windows 7.

Did you fix your loop ?
 
JamesMadden:

Yes, This is what I get,

Tried it with two different traders: FXCM & FxCentral both running Windows 7.

Sorry I forgot to ask, where did you install the MT4 ?, Is it in C:\Program Files\... ?.

You said after you reset the terminal, the pending is shown as open one. My guess is, your MT4 is not immediately updated with order status. At broker, your pending already turned into open, yet your MT4 still have them as pending, so you have ERR_INVALID_TRADE_PARAMETERS when tried to delete it.

I don't know if this helps, try install several MT4 from different brokers so you increase the data streaming. Use tools like NetLimiter (the free one - Google that) so you can see the network speed of your terminal (attached in here - scroll down - https://www.mql5.com/en/forum/138803).

And good luck.

:D

 

Hi all,

I've managed to reproduce the problem and get some logs from the Journal.

Line 5: 2012.06.25 03:44:09 '60015644': deleting of pending order #1245018 sell stop 1.00 EURUSD at 1.25370 sl: 0.00000 tp: 0.00000 failed [Invalid parameters]

Line 4: 2012.06.25 03:44:09 '60015644': delete pending order #1245018 sell stop 1.00 EURUSD at 1.25370 sl: 0.00000 tp: 0.00000


Line 3: 2012.06.25 03:44:06 '60015644': order sell stop 1.00 EURUSD opening at 1.25370 sl: 0.00000 tp: 0.00000 failed [Invalid S/L or T/P]
Line 2: 2012.06.25 03:44:05 '60015644': pending order sell stop 1.00 EURUSD at 1.25370 sl: 0.00000 tp: 0.00000
Line 1: 2012.06.25 03:44:05 '60015644': order was opened : #1245018 sell stop 1.00 EURUSD at 1.25370 sl: 0.00000 tp: 0.00000

In Line 1 it sates that the order was opened and confirmed as Pending in Line 2. line 3 states that there is a problem with the order but line 4 & 5 clearly state that the order is a pending sellstop order.

 
RaptorUK:
Did you fix your loop ?
Did you ?
Reason: