OrderSelect() function blurriness

 

Hello,

Newbie question: Try to code deleting a specific pending order from many. I am stuck on how to select it. In docs I saw that OrderSelect() function has ticket parameter and ticket of the order can be find with OrderGetTicket() but I am stuck with coding. A simple example will be very useful.

In fact I want to modify a specific order but I saw that can not change the lot volume with OrderModify() so I have to delete the old order and create a new one. 

Thanks in advance ! 

 
tenlau:

Hello,

Newbie question: Try to code deleting a specific pending order from many. I am stuck on how to select it. In docs I saw that OrderSelect() function has ticket parameter and ticket of the order can be find with OrderGetTicket() but I am stuck with coding. A simple example will be very useful.

In fact I want to modify a specific order but I saw that can not change the lot volume with OrderModify() so I have to delete the old order and create a new one. 

Thanks in advance ! 

See example code here. Once you get an order selected with right ticket, simply delete it instead of displaying detailed information as in the example.
 
angevoyageur:
See example code here. Once you get an order selected with right ticket, simply delete it instead of displaying detailed information as in the example.

Thanks got it !

But what you think regarding the impossibility to change the volume with OrderModify() ? It is too obvious to be an omission from MetaQuotes....The reason should be very clear but I can not get it. 

 
tenlau:

Thanks got it !

But what you think regarding the impossibility to change the volume with OrderModify() ? It is too obvious to be an omission from MetaQuotes....The reason should be very clear but I can not get it. 

I think, it's because your pending orders can be seen by others traders with the DOM (if available of course). But I am not a specialist of such things, maybe someone else can confirm.
 
angevoyageur:
I think, it's because your pending orders can be seen by others traders with the DOM (if available of course). But I am not a specialist of such things, maybe someone else can confirm.

Sorry, I am not familiar with DOM, but reading from Wikipedia what it means, I do not see any private relation with changing pending orders volume. You said "I think, it's because your pending orders can be seen by others traders". But this is also true for everything you do, so ...I do not see why for pending orders change of volume must be "covered"
 or not possible.



 
tenlau:

Hello,

Newbie question: Try to code deleting a specific pending order from many. I am stuck on how to select it. In docs I saw that OrderSelect() function has ticket parameter and ticket of the order can be find with OrderGetTicket() but I am stuck with coding. A simple example will be very useful.

In fact I want to modify a specific order but I saw that can not change the lot volume with OrderModify() so I have to delete the old order and create a new one. 

Thanks in advance ! 

Hi, you can't change the lot volume of a pending order, see the documentation https://www.mql5.com/en/docs/constants/structures/mqltraderequest. So the only way, you have to delete the old order and create a new one. May be you could contact the Service desk and make the suggestion of change volume possibility in pending order.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Trade Request Structure
Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Trade Request Structure
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / Trade Request Structure - Reference on algorithmic/automated trading language for MetaTrader 5
 

Hi, good topic and analysis, actually pending orders are not present at DOM.

The logical reason to don't allow modify pending orders at MT5, in my opinion, is regarding filling policy, since volume execution is very dependable on such policy.

Note that you can't modify filling policy too, since MT5 Trade Server needs negotiate again each policy if you modify it, and this can change other values you don't want.

So, as stated by biantoro, the only way is delete the pending order and create a new one with the new volume.

 

@figurelli, @biantoro

Thanks; as you both can see that from my first post I realize that I have to delete the old pendiong order and create a new one.

@angevoyageur

I confused DOM with "Document Object Model" but now I realize that you mean "Deph of Market". In any case I do not see a good/solid/real explanation why the volume of pending order can not be changed 

 
figurelli:

Hi, good topic and analysis, actually pending orders are not present at DOM.

DOM is pending orders. What else ?

 
angevoyageur:

DOM is pending orders. What else ?

I agree is pending orders !
 
figurelli:

Hi, good topic and analysis, actually pending orders are not present at DOM.

The logical reason to don't allow modify pending orders at MT5, in my opinion, is regarding filling policy, since volume execution is very dependable on such policy.

Note that you can't modify filling policy too, since MT5 Trade Server needs negotiate again each policy if you modify it, and this can change other values you don't want.

So, as stated by biantoro, the only way is delete the pending order and create a new one with the new volume.

Pending orders ARE present at DOM... actually, the DOM is simply a collection of pending orders!!! However, not all pending orders are present at the DOM, once it has a "depth"... so only pending order inside that depth limit are shown at the DOM.

I know several other softwares that can easily modify pending orders, without the need to "delete the old / send the new" order.

In this case, my only suspicion about this question is: although I cannot confirm it, the impossibility to modify an order's volume in MT5 is, IMHO, an architecture decision.