Already there. OrderSend fails GetLastError returns 138, you refreshRates and do another OrderSend with the new price.
As I help other forumers here at MQL4, I noticed that some of them write the OrderSelect() code incorrectly. I have no idea how these forumer write the OrderSelect() that way. Until this evening, after installing MT4 from FXCM using web installer - which I supposed downloading material from MetaQuotes server. I open MetaEditor, and look at "MACD Sample EA". Here's some part of the code which I think does not make any sense at all. I have good feeling that someone else may already complain about this, but whatever it is ...
... ... ... return(0); } // it is important to enter the market correctly, // but it is more important to exit it correctly... for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); // ==>> whatever the result, true or false, we continue executing next block of the code if(OrderType()<=OP_SELL && // check for opened position OrderSymbol()==Symbol()) // check for symbol { if(OrderType()==OP_BUY) // long position is opened { // should it be closed? ... ... ...
If there are no trades OrdersTotal() would be zero so the loop would exit at zero before OrderSelect() is called.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Preliminary Announcement of the New MetaTrader 4 Build 421
Over the next few days, we will release the MetaTrader 4 update.
In addition, from June 1, 2012 support for client terminals older than build 416 will be discontinued. In this regard, we strongly recommend all traders to update their trading terminals to the latest version as soon as possible.
MetaTrader 4 Client Terminal build 421
To improve the quality of registration data, added the following data validation (incomplete list):
MetaTrader 4 Mobile build 421, MetaTrader 4 Smartphone build 421
The update will be available through the LiveUpdate system.