need an example of getting result with ResultRetcode()

 

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. 

 
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.
 
Thanks for that answer. It is exactly what I was searching the forum for. (even though I did not ask the question)