CloseOrders() Function

 

Hi everyone.


I'm looking to program an EA to close all orders related to a magic number. I've noticed that in certain older posts that there is discussion around the "CloseOrders()" function, however I am not able to find it in the online database of functions. Is this:


a) an old function that no longer exists

b) a function that I have to write on my own (or, use the template provided here: https://www.mql5.com/en/forum/116395)

c) or something that exists but that I just can't seem to find on account of being a noob?


I don't mind having to write it out myself, but in the interest of avoiding on-screen clutter I'd love to use a function that already exists.


Thanks for your time,


Cornelius

How to close all open orders based on Magic number
How to close all open orders based on Magic number
  • 2009.04.13
  • www.mql5.com
The following function will close ALL Open positions-- void closeAllPositions() { while(OrdersTotal()>0) { OrderSelect(0,SELECT_BY_POS); if...