Script to close all negative trades first and then followed by positive trades – script MetaTrader 4

Usually when we close all trades, it is always from the last trades to the first one. Therefore, there will be positive and negative trades jumble up your closing trades history. It will not look good at all in your trades history. Using this modified script by me, it will cleanly close all trades with negative trades first and once finished, it will then close all remaining trades, which usually in profit. Using this script, it will make your trades history look way cleaner and nicer for viewing.  If you want to hire me to get the code working in your EA, I would be gladly do for you for some fee.

Enjoy and thank you.
📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks