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

 

"The VOM controls this risk by maintaining a server-based stop at a configurable distance away from the tightest virtual stop."

That's sounds fine at first, but (in some cases) what happen is that the server-based stop end up being tighter than the loosest virtual stop.

It's specially true if you decrease de distance, like:

Config.ServerStopLossMargin=1;

 Also, it would be great to have the same security system to keep the profits, maintaining a server-based take profit. Don't you think?

 

I've spent the last few days trying to get this working, but I am always getting the same type of error as Marcelo has mentioned above.  Does anyone know if this works anymore?  The error happens whenever I try to open a trade, even when using the examples supplied with VOM.  Is anyone able to help me get it working?  Any help would be much appreciated.

2018.01.31 07:49:36.762 VirtualOrderManagerTester (AUDCAD,H1)   CVirtualOrderManager::OnTick - startup tick or first local time tick of new day
2018.01.31 07:49:43.683 VirtualOrderManagerTester (AUDCAD,H1)   CVirtualOrderManager::PositionChangeSizeAtServer(AUDCAD,0.10,ORDER_TYPE_BUY,0.99455)
2018.01.31 07:49:43.686 VirtualOrderManagerTester (AUDCAD,H1)   CVirtualOrderManager::PositionChangeSizeAtServer error: Problem with OrderSend TRADE_ACTION_DEAL, return code Invalid request
 
kenshin71:

I've spent the last few days trying to get this working, but I am always getting the same type of error as Marcelo has mentioned above.  Does anyone know if this works anymore?  The error happens whenever I try to open a trade, even when using the examples supplied with VOM.  Is anyone able to help me get it working?  Any help would be much appreciated.

This library is now mostly obsolete as MT5 is providing hedging account. You can still need it on netting account, but is it really worth it.
 
Alain Verleyen:
This library is now mostly obsolete as MT5 is providing hedging account. You can still need it on netting account, but is it really worth it.

My ea is an expanding grid type one operating on one symbol, so I need to track each trade or grid level individually so that I know where to open the next level.  On MT4 I have been doing this by looking at the open trade list and using them to calculate the position where I need to open the next trade in the grid.  On MT5 I find it's dumping all the trades in one big position which completely kills that method.  For example, I can't have two buy trades open in MT5, because it combines them into one position.  How can I calculate where level six of a buy grid is going to be if I don't know where levels one through to five are?  I hope you can see what I mean.  This library was the only way I've found to get around that problem.  On MT4 I am also using unique magic numbers on each trade to identify each grid level. On MT5 I have found that I can't set unique magic numbers either, so I'm going to store them on disk instead.  If there is a better way to manage grid levels like this on MT5, I am eager to learn.

The ea is around 6000 lines long, so I'm not too keen to rewrite it.  I've spent the better part of 2 weeks getting it to compile properly on MT5, and I'm sure it will run fine once I change to storing magic numbers on disk instead of the broker server.

On a positive note, I did find out how to fix the errors in the VOM library, so hopefully this helps someone.  Using version 2 of the library, you need to change line 855 of the virtualordermanager.mqh file from :

MtRequest.type_filling=ORDER_FILLING_FOK;

to

MtRequest.type_filling=SYMBOL_FILLING_FOK;

then it will open trades properly with no errors.

 
kenshin71:

My ea is an expanding grid type one operating on one symbol, so I need to track each trade or grid level individually so that I know where to open the next level.  On MT4 I have been doing this by looking at the open trade list and using them to calculate the position where I need to open the next trade in the grid.  On MT5 I find it's dumping all the trades in one big position which completely kills that method.  For example, I can't have two buy trades open in MT5, because it combines them into one position.  How can I calculate where level six of a buy grid is going to be if I don't know where levels one through to five are?  I hope you can see what I mean.  This library was the only way I've found to get around that problem.  On MT4 I am also using unique magic numbers on each trade to identify each grid level. On MT5 I have found that I can't set unique magic numbers either, so I'm going to store them on disk instead.  If there is a better way to manage grid levels like this on MT5, I am eager to learn.

The ea is around 6000 lines long, so I'm not too keen to rewrite it.  I've spent the better part of 2 weeks getting it to compile properly on MT5, and I'm sure it will run fine once I change to storing magic numbers on disk instead of the broker server.

On a positive note, I did find out how to fix the errors in the VOM library, so hopefully this helps someone.  Using version 2 of the library, you need to change line 855 of the virtualordermanager.mqh file from :

to

then it will open trades properly with no errors.

That's why I said you there is now hedging account, which you should use as you are trading on Forex apparently. The account you are describing is a netting account.
 
Thankyou Alain.  I see what you mean now.  I apologise for not paying closer attention to what you said about hedging first.  It was driving me crazy trying to get this VOM working as well as all the other changes required to get my ea working under MT5.  I think I'll take a break from it and come back when I've had some sleep.  I do think I'll need write an MT5 specific version of the ea from the ground up though.  Up till now I have been trying to make a version that works under MT4 and MT5 using conditional compiling, but that idea is not really working out as cleanly as I'd like.  Thanks again for pointing me in the right direction.
 
Alain Verleyen:
This library is now mostly obsolete as MT5 is providing hedging account. You can still need it on netting account, but is it really worth it.

yeap ) such a common thing in SW development

 
kenshin71:
Thankyou Alain.  I see what you mean now.  I apologise for not paying closer attention to what you said about hedging first.  It was driving me crazy trying to get this VOM working as well as all the other changes required to get my ea working under MT5.  I think I'll take a break from it and come back when I've had some sleep.  I do think I'll need write an MT5 specific version of the ea from the ground up though.  Up till now I have been trying to make a version that works under MT4 and MT5 using conditional compiling, but that idea is not really working out as cleanly as I'd like.  Thanks again for pointing me in the right direction.
Did you get this to work? I would like to take this forward from where you left off if its ok to share the fixes you had to do. Unfortunately I need to use netting MT5 account and need to use VOM for virtual hedging.
Reason: