use Trade.mqh from ..\MQL5\Include\Trade\Trade.mqh
It is faster for beginners.
OrderSend in MQL5 works completely differently to MQL4.
bool OrderSend( MqlTradeRequest& request, // query structure MqlTradeResult& result // structure of the answer );
If you are coming from MQL4 and are having difficulty understanding MQL5 trade functionality, please read the following ...
Orders, Positions and Deals in MetaTrader 5
MetaQuotes, 2011.02.01 16:13
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.Sergey Pavlov, 2010.05.17 13:32
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
- www.mql5.com
// gLOBALLY #include <Trade/Trade.mqh> CTrade trade; void OnTick() { if(PositionsTotal() == 0) //replace with your condtions trade.BuyLimit(....); //for all kinds of pending orders }
hi everyone
@Chioma Obunadike
I didn't understand your answer, a Trade.BuyLimit is for placing limit orders waiting to be executed, but how do you retrieve the list of these orders if, for example, the robot restarts?
Best Reguards,
ZeroCafeine 🙂
I think this is your answer for the pending orders on this link, For volumes I think you can retrieve order volumes with the function: m_order.VolumeInitial()
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
this is my code for getting buy limit order in mql5, but when the code is compiled, there are 2 errors: 'OP_BUYLIMIT' - undeclared identifier, 'OrderSend' - wrong parameters count