The problem is that in strategy tester the Results tab shows open, modify and close order managements in separate lines. Probably the problem could be solved by programming EXCEL as well (to make a new spreadshit from the raw one) but the solution seems better to write a file by the EA.
I now converted your script to an indicator and I can call it from EA but the problem is that after changing the hstTotal definition from OrdersHistoryTotal() to OrdersTotal() it does not count any trade (hstTotal is 0), not even when attached to a live chart (it wrote the full history of the account before, both from EA and from live chart).
I am searching for the problem, no idea yet....
I now converted your script to an indicator and I can call it from EA but the problem is that after changing the hstTotal definition from OrdersHistoryTotal() to OrdersTotal() it does not count any trade (hstTotal is 0), not even when attached to a live chart (it wrote the full history of the account before, both from EA and from live chart).
I am searching for the problem, no idea yet....