the code compiled correctly, but something when wrong - page 2

 
Don't call functions that selects orders and then try to use your (no longer) selected order.
 
Michael:can you provide me with a reference that I can read regarding this issue that would help me understand fully the issue and how can I overcome it in my future work?

Yes! Its called the MQL4 Reference documentation - https://docs.mql4.com/

Read up on Trade functions in particular!

There are also several CodeBase examples and Articles which you can read to get better acquainted with trading functions. Also consider reading a book or two on the subject of MQL4 programming.

 
Noted , thanks
Reason: