1 Click to Close All Open Positions in the Current Attached Chart - MetaTrader 4 Expert - MT4/MT5 Resource

Click the "Close All" button to close all open positions currently in the attached chart.
Select Close Manual Trading Only = True Only Manual Trading is Closed.
Choosing to close only manual trades = incorrectly closing manual trades and/or other trades opened by the Expert Advisor.
This new version does not contain the previous version of code written below which could cause an infinite loop.
if (view order closed == false ) continue ;
But instead brought in an error control system to prevent infinite loops while still closing all transactions.
if (check order closed == false ) { integer error code = get last error (); if (errorcode== 1 ||errorcode== 2 ||errorcode== 5 ||errorcode== 6 ||errorcode== 64 ||errorcode== 65 ||errorcode== 132 ||errorcode== 133 ||errorcode== 139 ) rest ; Continue with others ; }

Attachment download
📎 1clickcloseallv02.mq4 (4.84 KB)
Source: MQL5 #14869
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •