The order management system has completely changed in Metatrader 5. Now an order is a request to execute a trade operation, the result of which can be a trade. A position is the total state of trades on a certain financial security. Any financial security can have only one position. Unlimited orders are possible but with only one resulting position per pair. This means that there won't be possible to hedge orders anymore. According to Metaquotes, this change in the trading system was made to make MetaTrader 5 compatible with other markets, where such system is a standard. Now MetaTrader 5 allows working on the much wider range of markets, than MetaTrader 4. And that was a reason to rewrite the trading system totally.

So MT5 will take away the hedge ability by offsetting long and short trades into one position (NFA ruling compliance*). If this is case, it is very bad news to many traders who use hedging as part of their trading strategy. Moving accounts from US to UK or other countries which still allow hedging will be pointless once brokers start switching to the Metatrader 5 platform.

Order Buy 1.00 EURUSD Buy 1.00 EURUSD Sell 3.00 EURUSD
MetaTrader 5 Position (add) Buy 1.00 EURUSD (modify) Buy 2.00 EURUSD (modify) Sell 1.00 EURUSD
MetaTrader 4 Position (add) Buy 1.00 EURUSD (add) Buy 1.00 EURUSD

(add) Buy 1.00 EURUSD

(add) Buy 1.00 EURUSD

(add) Buy 1.00 EURUSD

(add) Sell 3.00 EURUSD


Metatrader 5 order management system: Just before it was called "Add a position" (MT4-style) and now is "modify position" (MT5-style). This implies that "closing" no longer has any real meaning in relation to individual orders. An EA can "close its position" by e.g. selling 2 lots if it's currently 2 lots long, but you no longer close an individual order. The screenshot below implies this by apparently showing open positions rather than open orders - no ID numbers on the open positions/orders. This means that individual orders can either be filled or waiting to be filled (i.e. pending), but not closed. If individual orders did still have an open/closed status, then there would effectively be lots of mini positions for each symbol, breaking the rule that "Any financial security can have only one position."

Wether or not is position-based or order-based, the equity will work same way : even if you have a buy and a sell, opened at the same time, same size, there will be a hedge, and equity will not move. The implication of position model influences only the active management in the EA -> you have to know what orders you already opened, thing that could be done implementing own history with an array that's updated every time a pending order is filled.

metatrader5

With this system, running different ea's on the same pair could result in a complete mess. Just imagine if you have an ea working on a daily strategy and another working on the same pair on 5m timeframe. On a retracemen of d1 the 5m will close the position (if of the same size). So running complex strategies on the same pair is now impossible. For example, a strategy that is working on a daily timeframe goes 1 lot long on eurusd. At a certain point, a strategy working on the same pair on 5m timeframe goes short of 1 lot (both on the same account). With Metatrader 4 we will have 2 positions that will be managed by the two different systems. When 5m strategy hits its target, tp or sl, it will close the position letting the d1 strategy run on its own. With Metatrader 5, +1 lot - 1 lot = 0 lot. Position closed and flat. Therefore, an EA in MetaTrader 5 needs to think in terms of the orders it has placed, calculating its own position from those orders rather than using the overall position returned by the platform.

*NFA ruling compliance: Recently the NFA issued new regulations prohibiting traders from hedging (having long and short positions open on the same currency pair at the same time).

Some suggestions from traders:

- If the unique limitation to mantain separate orders is the need to manage stock and futures I believe that is enough to add a market constraint or to introduce a oveload of the OrderSend function, specific for that market.

- I have talk with some broker and everyone say me that for trading stock and forex I need two separete account. If it's true it is very simple to resolve the order management problems: if I trade with OTC account the order mantains old management way, i I trade on regolated market I need to use new OrderSend function that will be management with new management way.

Read more here: http://forum.mql4.com/22700/page2

6 comments

Unknown said... @ June 16, 2009 at 11:58 PM

This article repeats verbatim large chunks of a post I wrote at http://forum.mql4.com/22700/page2. An attribution would have been polite.

miranon said... @ June 17, 2009 at 1:15 AM

MT, yes, i took some thoughts from the mql4 forum. I added a link to the forum page below the post. ;) If you want i can add also another link to your forum profile.

Unknown said... @ June 28, 2009 at 6:04 PM

> So MT5 will take away the hedge ability by offsetting long and short trades into one position

vs.

>Wether or not is position-based or order-based, the equity will work same way : even if you have a buy and a sell, opened at the same time, same size, there will be a hedge, and equity will not move.

So, which is it?

Paul said... @ July 22, 2009 at 1:10 AM

I don't see a problem.

Right now, most MT4 EAs have code in them which counts up all open positions for that magic no. and pair.

If not already provided in the MT5 language, the equivalent would be a virtual position maintainer, complete with virtual stops and TPs, and for robustness stored in global variables. It could even draw the green and red dotted lines on the chart just like MT4

Some EAs written in MT4 do this already so that they can run stealth stops to avoid the possibility of stop-hunting.

My main concern with this approach would be the reliance on a solid internet connection to process the stops.

Eric said... @ January 6, 2011 at 7:32 AM

One question, how to calculate pip.

If I buy 1 lot at 1.8000 and 1 lot at 1.8010. Then sell 1 lot at 1.8030. How many pip earn? 30 or 20

Eric cascio said... @ January 6, 2021 at 12:04 AM

Finally I got my lost funds recovered in binary option,  I lost my money I invested in binary option to a scam broker who ripped off my money and I never saw them again I became more depressed.  Some time ago a good friend of mine referred me to  (recoverylostfundsback ) the platform came for my rescue and with their master class intelligence and strategies and they helped me place a profitable trade and also recovered all my lost funds from those scam broker and a successful withdraw. They are expert when it comes to recovery of lost funds and they offer best services to your own satisfaction. I feel honoured to recommend any one to this wonderful platform  and thank me later,  you can contact for assistance and on how you can make a good profitable trade, recovery of lost funds, free signals  and stop losing money to heartless brokers.                                    recoverylostfundsback@gmail.com

Post a Comment