To read evolution results into PowerShell object use the command like in following example:
$csv = Import-Csv .\Evolutions\EVO_1\EVO_1_AllGenerations_results.txt -Header "Strategy","Initial Depo","Net profit","Gross profit","Gross loss","Profit factor","Expected payoff","Absolute DD","Maximal DD","Maximal DD[%]","Relative DD[%]","Relative DD","Trades total","Short trades","Short trades won[%]","Long trades","Long trades won[%]","Profit trades","Profit trades[%]","Loss trades","Loss trades[%]","Largest profit","Largest loss","Average profit","Average loss","Average consecutive wins","Average consecutive losses","Max consecutive wins","Max consecutive wins [value]","Max consecutive losses","Max consecutive losses [value]","Max consecutive profit","Max consecutive profit[num]","Max consecutive loss","Max consecutive loss[num]","Tree depth","Nodes number","Fitness","Generation","Trading mode" -Delimiter ";"
It is necessary to provide headers list as the CSV contains ‘;’ as last character in each row which is interpreted by PowerShell Import-CSV cmdlet as new column with no name.
You can verify if the file was read properly:
$csv | Get-Member
PowerShell even contains build in viewer:
$csv | Out-GridView
To process the file further it’s worth to remove the first row which contains the header names and will yield conversion errors:
$csv = $csv[1..$csv.Count]
To obtain 3 strategies with best profit try following:
$csv | sort {[double]$_."Net profit"} | select -last 3
You can even format the output like:
$csv | select "Generation","Strategy","Profit factor","Net profit"| sort {[double]$_."Net profit"} | select -last 3
or
$csv | sort -Descending {[double]$_."Net profit"} | select -first 3 | Format-Table "Generation","Strategy","Profit factor","Net profit"
To obtain statistical properties you may use something like:
$csv | measure -Property "Net profit" -Sum -Average -Maximum -Minimum