MQL5 Documentation Now Available in English (Mostly!)
Following the recent release of a beta version of MetaTrader 5 to the public expert advisor vendors have been struggling to get to grips with the new MQL5 language. Being able to read Russian has helped, but even then some vital information has been missing from the available documentation.
Things have now improved somewhat, since an official version of the MQL5 help file translated into English is now available from MetaQuotes. However the frequent Live Updates that the platform has been undergoing recently don't seem to transfer the file to your hard drive automatically. However, if you download the latest version of MetaTrader 5 and reinstall the software you will then be able to access the English technical reference manual via the "Help" menu in MetaEditor.
There is finally even a brief description of the OnTrade() function that we've been desperately waiting for. Unfortunately it's still in Russian! Here is what Google Translate makes of it:
Function is called upon the occurrence of Trade, which occurs when you change the list put up orders and open positions, the history of orders and transaction history. In any trading activities (a display of a pending order, the opening / closing position, setting stops, triggered pending orders, etc.) accordingly changed the history of orders and transactions and / or a list of positions and current orders.
void OnTrade ();
Users must independently verify the code to implement state trading account upon receipt of this event (if required under the terms of the trading strategy). If the function call OrderSend () completed successfully and returned a value of true – this means that the trading server put in place a warrant of execution and granted him the ticket number. As soon as the server will process this order will be generated event Trade. And if the user remember the value of ticket, then the processing events OnTrade () it can be on the ticket to find out what happened to the warrant.
I take that to mean that OnTrade() fires when the status of an Order/Trade/Position changes. However MetaTrader 5 doesn't let OnTrade() know which one has changed. The expert advisor still has to somehow work that out for itself. Not completely useless then, but not far from it. We will investigate further, and let you know if things really are as bad as our first impression suggests.
Tags: Beta, Forex Trading Platform, MetaTrader, MetaTrader 5
Filed under Trading Platforms by Jim
Comments on MQL5 Documentation Now Available in English (Mostly!)
Jim @ 1:35 pm
Stop Press – MetaQuotes have just published an updated version of the MQL5 technical reference on the MQL4 forum. The OnTrade() description is now in English, but its functionality doesn't seem to have improved at all.
Guillermo Rexach @ 5:38 am
Hi Jim:
I am new to MQL5 and am in the process of converting an MQL4 program to MQL5. Could you please direct me to how to retrieve a list of open orders in MQL5? Corresponding to the OrderFields in MQ4(OrderSymbol(). OrderType(), etc. Basically what has to be done to process the MQL4 parsing of orders used in the Select
ex
for(int i=0;i< OrdersTotal();i++)
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)
&& OrderSymbol() =="EURUSD"
{
some code
}
Thanks in advance
Jim @ 6:28 pm
Hi Guillermo,
This sort of question is better suited to our community forum, so I've copied it over there. I've also posted a (probably mostly inadequate!) answer there too.
Cheers,
Jim