Discussion of article "A Virtual Order Manager to track orders within the position-centric MT5 environment" - page 2

 

There is a major problem with this library. Trades opened with VOM and closed manually are seen opened by VOM.

More than that when in VOM I try to close this trades, VOM will open trades in opposite direction.

For example:

- I open 5 buy orders with  VirtualOrderManagerTester and is ok

- I close manually all 5 orders: in MT5 I see no orders and on chart(VOM) 5 open orders

- I close the 5 orders from VirtualOrderManagerTester: I see 5 sell orders in MT5 and none in VOM(VirtualOrderManagerTester)

In my opinion this is a major problem because if my EA  orders are closed by broker or other EA, when my EA will try to close it using VOM, will open orders in opposite direction.

There is any solution for this problem?

Files:
vom_test.jpg  188 kb
 
mbt22:

There is a major problem with this library. Trades opened with VOM and closed manually are seen opened by VOM.

More than that when in VOM I try to close this trades, VOM will open trades in opposite direction.

For example:

- I open 5 buy orders with  VirtualOrderManagerTester and is ok

- I close manually all 5 orders: in MT5 I see no orders and on chart(VOM) 5 open orders

- I close the 5 orders from VirtualOrderManagerTester: I see 5 sell orders in MT5 and none in VOM(VirtualOrderManagerTester)

In my opinion this is a major problem because if my EA  orders are closed by broker or other EA, when my EA will try to close it using VOM, will open orders in opposite direction.

There is any solution for this problem?

 

Hi mbt22,

what you highlight is definitely a limitation of this library - all EAs running on an account must use the VOM, and that includes manual trades.  

Bear in mind however that this sociability limitation of the VOM EAs is likely to be seen in many MQL5 EAs.  In other words, these EAs can also fail in the event of manual trades or other EAs of any type operating on the same symbol.

Here's an example of a non-VOM EA sociability failure.  Supposing trades (manual and/or EA-generated) external to that EA total 1.0 lots short, and the EA issues a buy order of 0.1 lots with a 50 pip stop.  I can't remember exactly how the OrderSend function in the EA would work (whether is completes or returns a stop error), but what is certain is that the stop cannot be applied 50 pips below the resultant position size of 0.9 lots short.

The test EA is able to manage manual trades using the VOM, but if the situation gets to the broker closing orders then the VOM has lost control and careful assessment of the account would be needed.

One of the main reasons that the VOM is not sociable with non-VOM activities is its management of the disaster protection stop, which is an absolute risk management essential in any client-based trade closure process.

Paul 

 

 

 
phampton:

 

Hi mbt22,

what you highlight is definitely a limitation of this library - all EAs running on an account must use the VOM, and that includes manual trades.  

Bear in mind however that this sociability limitation of the VOM EAs is likely to be seen in many MQL5 EAs.  In other words, these EAs can also fail in the event of manual trades or other EAs of any type operating on the same symbol.

Here's an example of a non-VOM EA sociability failure.  Supposing trades (manual and/or EA-generated) external to that EA total 1.0 lots short, and the EA issues a buy order of 0.1 lots with a 50 pip stop.  I can't remember exactly how the OrderSend function in the EA would work (whether is completes or returns a stop error), but what is certain is that the stop cannot be applied 50 pips below the resultant position size of 0.9 lots short.

The test EA is able to manage manual trades using the VOM, but if the situation gets to the broker closing orders then the VOM has lost control and careful assessment of the account would be needed.

One of the main reasons that the VOM is not sociable with non-VOM activities is its management of the disaster protection stop, which is an absolute risk management essential in any client-based trade closure process.

Paul 

 

 


Ok.

Thank you for your quick response.

 

Hello Paul,

 

Thank you for this library.

 

It seems to me that no matter what I use for a Take Profit value a trade is never closed at that value, even when I run your FrAmaCross EA and optimize it with just the take profit the results never change.

 

I am I doing something wrong or is there a flag that needs to be set to use Take Profit?

When looking at your code the your call in OrderSend bSuccess=PositionChangeSizeAtServer(symbol,volume,ORDER_TYPE_BUY,stoploss); break;

doesn't  use the Take Profit value

 

Thank you for your Time

EK 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 

I think - if we can have own VOM .. beter way to implement this in mt5 by MQ - id for local orders (#1,#2,#3) in mt5 terminal conected to 1 global order on mt5 server (#5423523).

We need only tree order 

+ #5423523 eurusd

- #1 buy

- # 2 buy

+ #5423533 usdjpy

- # 3 sell

- # 4 sell

+ #5423533 gbpjpy

- # 5 sell


Then on chart we have orders #1 , 2# etc..

 

I have been using the VOM ever since I first wrote it, have fixed a number of bugs, mostly with the handling of the protective stop, and also changed the code to match changes in MT5.  Attached are the updated files.  

Comments very welcome.

Paul 

Files:
VOM2p0.zip  609 kb
 
phampton:

I have been using the VOM ever since I first wrote it, have fixed a number of bugs, mostly with the handling of the protective stop, and also changed the code to match changes in MT5.  Attached are the updated files. 

New version is attached to the article.
 
phampton:

I have been using the VOM ever since I first wrote it, have fixed a number of bugs, mostly with the handling of the protective stop, and also changed the code to match changes in MT5.  Attached are the updated files.  

Comments very welcome.

Paul 


 

This newer version also doesn't contain a proper file "Supports and Resistances..." but only a second copy of another EA. Also the "...Order Manager Tester" is actually entitled "...Order Tester". Is this the right file?

Thanks!

 

Hi Paul,

Can y please help me here.

I am getting a Lots error but as you see below, the lots is hardcoded and even like this it is not working (pict atached).

Can y please help me if possible ?

Regards,

MRC 

      if(glOrder==-1)
        {
         mrequest.type=ORDER_TYPE_SELL;
         mrequest.price=NormalizeDouble(price_info.bid,_Digits);
         mrequest.sl=NormalizeDouble(price_info.bid+StopLoss,_Digits);
         mrequest.tp=NormalizeDouble(price_info.bid-TakeProfit,_Digits);
         mrequest.comment="SELL";

         VOM.Sell(Ativo,5.0,(int)StopLoss,(int)TakeProfit);

         if(UsaRelatorio==true) Report("B VENDA");
        }

 2014.07.21 16:05:10.497 YouBotG3VOM (WINQ14,H1) CVirtualOrderManager::OrderSend error: failed to adjust position at server, returning -1

2014.07.21 16:05:10.497 YouBotG3VOM (WINQ14,H1) CVirtualOrderManager::PositionChangeSizeAtServer error: Problem with OrderSend TRADE_ACTION_DEAL, return code Autotrading disabled by client terminal. OrderCheck() returned Trading by Expert Advisors prohibited

2014.07.21 16:05:10.495 YouBotG3VOM (WINQ14,H1) CVirtualOrderManager::PositionChangeSizeAtServer(WINQ14,5.00,ORDER_TYPE_BUY,57765)