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
You must be getting the warning that the return value of OrderClose should be checked when compiling.
Do it.
You must be getting the warning that the return value of OrderClose should be checked when compiling.
Do it.
Is this what you mean? I just tried this
Is this what you mean? I just tried this
No.
Returned value
Returns true if successful, otherwise false. To get additional error information, one has to call the GetLastError() function.
No.
Print the error if it fails.Im not sure how to correctly do that
This is what in various forms, but doesnt print or show error
Then, as a coder you should be asking yourself "Why doesn't it print the error??"
The obvious answer is because there was no error!
If there was no error, then it can only be because there was no attempt to close any trade (or because a trade was closed).
What are the possible reasons for there being no attempt to close any trade?
Only possible answers.......
There was not a trade open with the symbol.
The OrderSelect() failed.
The function was not called.
Add prints in your code to find the correct answer.
This is what in various forms, but doesnt print or show error
There is no type of order to be closed in your code. (OP_BUY, OPSELL)
This is what in various forms, but doesnt print or show error
There is no type of order to be closed in your code. (OP_BUY, OPSELL)
I have since tried a different CloseAllOrders function and I tried to implement the code you shared, but orders are still not closing.
This is what I have currently Ive tried printing out errors for the CloseAllOrders but they do not close. Any help is appreciated.
There is not even a single Print in your code!