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

Script to close all negative trades first and then followed by positive trades - script for 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