Forex Blog

First-hand Forex trading experience and information about foreign exchange market that will be useful to traders


MT5 Build 381 Messes with Standard .Type() Methods

January 20, 2011 by

Build 381 that was released by MetaQuotes for MetaTrader 5 yesterday had many useful changes, but it also messed up with the standard libraries, rendering some of the working expert advisors useless. The problem still remains as of build 384 and probably won’t be fixed in the next builds.

The change #12 states:

MQL5:Updated the Standard Library: the Type() methods of classes CDealInfo, CHistoryOrderInfo, COrderInfo and CPositionInfo are renamed to DealType(), OrderType() and PositionType() respectively.

This has a rather bad consequence for all the EAs that relied on the Type() method. They just will stop work as intended — the method will always return 0. And the aggravating circumstance is that the expert advisors using that method will still compile without error, as all the objects that use it are derived from CObject class, which has such method but it always returns 0.

I understand that MT5 is still in an active development stage, but some Forex brokers already use MetaTrader 5 for real accounts (InstaForex) and many traders with EAs could have experienced a loss due to this change.

So, if you are using any MT5 EAs that rely on CDealInfo, CHistoryOrderInfo, COrderInfo or CPositionInfo classes, please, update them to use DealType(), OrderType() and PositionType() methods, respectively.

One of my MT5 EAs — Amazing — had the issue. It’s been updated already so, you should download a new version if you are using it.

If you encountered some other strange errors and bugs in MetaTrader 5 and want to ask questions about them or just share your experience, please, feel free to reply in the commentary form below.

Leave a Reply

required (will not be published)