ResultRetcodeDescription - MetaTrader 5 Library - MT4/MT5 Resources
This simple function returns the decrypted code string of the result of the trading operation . The MqlTradeCheck result is executed after the OrderCheck() function:
MqlTradeCheck result view; //---- Check the correctness of the transaction request if (! Order check (request, check)) { print ( __Function__ , "(): Order Check():" , ResultRetcodeDescription(check.retcode)); return ( false ); }
Alternatively, it can return a string from the MqlTradeResult after executing the OrderSend() function:
MqlTradeCheck result viewing; word = __function__ + "(): OrderSend():" ; //---- Open a buy position and check the trade request result if (! OrderSend (Request, Result) || Result.retcode!= TRADE_RETCODE_DONE ) print (ResultRetcodeDescription(Result.retcode)); Else if (result.retcode== TRADE_RETCODE_DONE ) print ( "Buy position" , symbol (), "Open!" ); else print ( "Failed to establish a buy position for "" , symbol (), "!!!" );
The function uses the library ResultRetcodeDescription.mqh (to be copied to Terminal_data_directory\MQL5\Include), its content should be included in the developed code using the #include directive before using the function at the global level:
Attachment download
📎 resultretcodedescription.mqh (3.34 KB)
Source: MQL5 #960
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •