If your program compiles without any error but doesn't do what it should start the debugger and check the relevant variables:
https://www.metatrader5.com/en/metaeditor/help/development/debug // Code debugging
https://www.mql5.com/en/articles/2041 // Error Handling and Logging in MQL5
https://www.mql5.com/en/articles/272 // Tracing, Debugging and Structural Analysis of Source Code
https://www.mql5.com/en/articles/35 // scrol down to: "Launching and Debuggin"

Code debugging - Developing programs - MetaEditor Help
- www.metatrader5.com
MetaEditor has a built-in debugger allowing you to check a program execution step by step (by individual functions). Place breakpoints in the code...
I Have insert a Flag to print the ticket number so we can see if the problem was in there, but number ticket is ok, so the problem comes from PositionClosePartial, any Idea??
William Roeder #:
You can not get the ticket until you first select a position https://www.mql5.com/en/docs/trading/positiongetinteger
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)
You can not get the ticket until you first select a position https://www.mql5.com/en/docs/trading/positiongetinteger
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)

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
Goof day can anyone help me with these, I am trying to close partial my positions but I get error in the trade because it does not enter to the if() trade
I try to print error using trade.ResultRetcode() but it gives me " method failed. Return code=0. Code description: unknown retcode 0
I also ron my EA in Backtesting and this woks fine it does closePartial so I dont know why It does Not works running the EA normally
Can anyoe help me please