Does not sound good, can you show some code?
Hello,
Quick question on good programming practices.
I have a trade entry manager EA which, after the users clicks to buy/sell then tries to immediately select the ticket number (which was captured during the market order entry process).
Sometimes, the EA selects it successfully (open position) with PositionSelectByTicket(), other times, it fails, even thought attempting to use the correct ticket number etc.
I seem to have resolved the problem by putting the PositionSelectByTicket() inside a loop that iterates 5 times with a 500ms Sleep() until it successfully selects the ticket.
Curious if this is the correct approach, or if there is a better approach, or if there is an inherent problem using this approach.
Thanks!
What is the ping time your MT client shows?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Quick question on good programming practices.
I have a trade entry manager EA which, after the users clicks to buy/sell then tries to immediately select the ticket number (which was captured during the market order entry process).
Sometimes, the EA selects it successfully (open position) with PositionSelectByTicket(), other times, it fails, even thought attempting to use the correct ticket number etc.
I seem to have resolved the problem by putting the PositionSelectByTicket() inside a loop that iterates 5 times with a 500ms Sleep() until it successfully selects the ticket.
Curious if this is the correct approach, or if there is a better approach, or if there is an inherent problem using this approach.
Thanks!