Running multiple experiments

This instruction shows how to use PowerShell to perform multiple experiments consecutively. Use following commands to setup and start 50 experiments.

First it’s worth to prepare configuration files for experiments.  Following command will take care of that.

PS C:\Program Files (x86)\PipsEvolution> 1..50 | foreach { echo "[STRATEGY]
 EVOLUTION_NAME=EVO_$_" > PipsEvolutionConfig$_.ini}

Of course make sure to adjust all other config file options you want to set up in each of the experiments.

To run all the experiments consecutively type:

PS C:\Program Files (x86)\PipsEvolution> 1..50 |  foreach { .\PipsEvolution.exe -c PipsEvolutionConfig$_.ini}

Run the following script to find 10 strategies with best profit among all the experiments (technically speaking it’s not 100% true as it’s 3 strategies from each experiment with best profit and then 10 best out of it). To find more about reading files with evolution results read following article: Reading CSV results.

$a=@()
1..50 | foreach { 
    $experiment=$_
    $csv = Import-Csv  .\Evolutions\EVO_$_\EVO_"$_"_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 ";"
    $csv = $csv[1..$csv.Count]
    $csv = $csv | sort {[double]$_."Net profit"} | select -last 3 | Select-Object *,@{Name='Experiment';Expression={"EVO_$experiment"}}
    $a+=$csv
    # Free memory
    [GC]::Collect()   
}

$a | select "Experiment", "Generation","Strategy","Profit factor","Net profit"| sort {[double]$_."Net profit"} | select -last 10 | Format-Table

This command will produce output like:

Experiment               Generation               Strategy                 Profit factor            Net profit              
----------               ----------               --------                 -------------            ----------              
EVO_10                   9                        325                      1.8801                   1057.55                 
EVO_10                   8                        437                      1.8801                   1057.55                 
EVO_10                   9                        3                        1.8801                   1057.55                 
EVO_48                   9                        201                      2.4537                   1086.91                 
EVO_25                   6                        272                      1.6887                   1096.48                 
EVO_25                   9                        411                      1.6887                   1096.48                 
EVO_25                   8                        19                       1.6887                   1096.48                 
EVO_6                    8                        275                      1.861                    1161.51                 
EVO_6                    9                        456                      1.861                    1161.51                 
EVO_6                    9                        377                      1.861                    1161.51
Advertisements