This free code manages to close all positions complying FIFO rules just by drag and drop into the chart, no matter if profit or loss.
This is MQL5 version of Shved Supply and Demand indicator written by Shved and upgraded by eevviill7 from this link. Subsequently Mr. Behzad Movaghar added other functionalities to this link. This version of the Indicator contains the Code with an option to select the time frame of the Indicator other than that of the chart. For example if the chart is in 5M and the user want to see the support and Resistance levels of a particular chart pair at 15 M, is possible with this.Sample check pending order
Check exists pending order prevent duplicate create pending order