Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ResultRetcode function #119

Closed
vyacheslav-skvortsov opened this issue May 8, 2018 · 4 comments
Closed

Implement ResultRetcode function #119

vyacheslav-skvortsov opened this issue May 8, 2018 · 4 comments

Comments

@vyacheslav-skvortsov
Copy link

vyacheslav-skvortsov commented May 8, 2018

Hi!
Could you Implement ResultRetcode() CTrade function in MT5?
For example, if trade.PositionClose(ticket, deviation) returns false I need to know exact error was occurred. In my case it was NO_MONEY and ResultRetcode() returned the code: 10019.

From PositionClose article:

Note

Successful completion of the PositionClose(...) method does not always mean successful execution of the trade operation. It is necessary to check the result of trade request (trade server return code) using ResultRetcode().

@vdemydiuk
Copy link
Owner

Hi,
Yes, I will implement function ResultRetcode in next version.

@vdemydiuk
Copy link
Owner

Function ResultRetcode can't be implemented because it can work with CTrade structure only. But this structure is not stored after call function PositionClose.

I have added out parameter to function PositionClose (same to PositionOpen):
public bool PositionClose(ulong ticket, ulong deviation, out MqlTradeResult result)
public bool PositionClose(ulong ticket, out MqlTradeResult result)

MqlTradeResult structure has all needed information about trade function.

Please confirm, is this implementation correct for you?

@vyacheslav-skvortsov
Copy link
Author

This implementation is correct for me!
Thank you!

@vdemydiuk
Copy link
Owner

Great. I am closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
MtApi MT5
Awaiting triage
Development

No branches or pull requests

2 participants