Count number of simultanious open Trades

Hi

I’m bulding an app analyze trades (based on Metatrader 5 history export) and I’ld like to count the number of simultanious open trades.

The list looks like this the below. I need to know how many simultanious trades are open. Has anyone a good idea how to develop this? Would be appreciated

Thanks
Daniel

First time field is the Trade Open Date/Time, 2nd Time field is the Trade Close date/time

Time;Type;Volume;Symbol;Price;S/L;T/P;Time;Price;Commission;Swap;Profit;Comment
2021.03.05 19:16:10;Sell;0.01;XAUUSD;1 701.00;;1 699.00;2021.03.05 20:54:35;1 699.00;;;1.68;[tp]
2021.03.05 19:25:38;Sell;0.01;XAUUSD;1 702.00;;1 700.00;2021.03.05 19:34:43;1 700.00;;;1.68;[tp]
2021.03.05 15:46:08;Sell;0.01;XAUUSD;1 699.99;;1 699.00;2021.03.05 15:47:31;1 699.00;;;0.83;[tp]
2021.03.05 14:55:06;Sell;0.01;XAUUSD;1 697.83;;1 697.00;2021.03.05 15:13:14;1 696.64;;;1.00;[tp]
2021.03.05 14:55:19;Sell;0.01;XAUUSD;1 697.91;;1 697.00;2021.03.05 15:13:14;1 696.70;;;1.01;[tp]
2021.03.05 14:57:46;Sell;0.01;XAUUSD;1 698.73;;1 698.00;2021.03.05 15:00:18;1 698.00;;;0.61;[tp]
2021.03.05 13:33:02;Sell;0.01;XAUUSD;1 697.50;;1 696.50;2021.03.05 13:46:10;1 696.50;;;0.84;[tp]
2021.03.05 12:33:29;Sell;0.01;XAUUSD;1 695.93;;1 694.12;2021.03.05 13:07:04;1 694.12;;;1.52;[tp]
2021.03.05 12:20:09;Sell;0.01;XAUUSD;1 695.29;;1 694.66;2021.03.05 12:59:24;1 694.66;;;0.53;[tp]
2021.03.05 12:22:00;Sell;0.01;XAUUSD;1 695.34;;1 694.34;2021.03.05 12:28:08;1 694.34;;;0.84;[tp]
2021.03.05 10:37:09;Sell;0.01;XAUUSD;1 694.48;;1 693.48;2021.03.05 10:42:47;1 693.48;;;0.84;[tp]
2021.03.05 07:33:34;Sell;0.01;XAUUSD;1 695.00;;1 694.50;2021.03.05 10:04:54;1 694.50;;;0.42;[tp]
2021.03.05 05:10:09;Sell;0.01;XAUUSD;1 695.00;;1 693.00;2021.03.05 06:16:35;1 693.00;;;1.67;[tp]
2021.03.01 10:02:32;Sell;0.10;ZAR40;62 089.00;;60 721.31;2021.03.04 21:05:38;61 804.00;;0.03;1.55;

@danielruppen As far as I know, list the close_date and loop over it and compare with the current date.

<cfset close_date = "2021.03.05 20:54:35, 2021.03.05 19:34:43, 2021.03.05 15:47:31, 2021.03.05 15:13:14, 2021.03.05 15:13:14, 2021.03.05 15:00:18, 2021.03.05 13:46:10, 2021.03.05 13:07:04, 2021.03.05 12:59:24, 2021.03.05 12:28:08, 2021.03.05 10:42:47, 2021.03.05 10:04:54, 2021.03.05 06:16:35, 2022.03.05 06:16:35, #now()#">
<cfset open = 0>
<cfset close = 0>
<cfloop list="#close_date#" item="list">
    <cfset datediff = dateCompare(now(), list)>
    <cfif datediff LTE 0>
        <cfset open = open+1>
    <cfelse>
        <cfset close = close+1>
    </cfif>
</cfloop>
<cfdump var="#open#" label="open_trades"/>
<cfdump var="#close#" label="closed_trades"/>

Hey thank you very much, very lean code and it works

Many thanks
Regards
Daniel