Download MetaTrader 5

need an example of getting result with ResultRetcode()

To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
sd2000sd
212
sd2000sd 2014.01.29 17:44 

ResultRetcode

Gets the code of request result.

uint  ResultRetcode() const 

Returned value

The Code of request result.


How can I get the result using the above function? in CTrade class I mean.

Thanks

Please give an example. 

Rogerio Figurelli
Moderator
39652
Rogerio Figurelli 2014.01.29 21:35  
sd2000sd:

ResultRetcode

Gets the code of request result.

uint  ResultRetcode() const 

Returned value

The Code of request result.


How can I get the result using the above function? in CTrade class I mean.

Thanks

Please give an example. 

 

Take a look at this article https://www.mql5.com/en/articles/481 and example below using Ctrade, probably will help you. 

//--- 1. example of buying at the current symbol
   if(!trade.Buy(0.1))
     {
      //--- failure message
      Print("Buy() method failed. Return code=",trade.ResultRetcode(),
            ". Code description: ",trade.ResultRetcodeDescription());
     }
   else
     {
      Print("Buy() method executed successfully. Return code=",trade.ResultRetcode(),
            " (",trade.ResultRetcodeDescription(),")");
     }
Trade Operations in MQL5 - It's Easy
Trade Operations in MQL5 - It's Easy
  • 2012.08.21
  • MetaQuotes Software Corp.
  • www.mql5.com
Almost all traders come to market to make money but some traders also enjoy the process itself. However, it is not only manual trading that can provide you with an exciting experience. Automated trading systems development can also be quite absorbing. Creating a trading robot can be as interesting as reading a good mystery novel.
To add comments, please log in or register