Page 1 of 1

Console Optimizer

PostPosted: Wed Feb 08, 2017 12:16 pm
by Konstantin.Toporov
Let's imagine a situation when there is a trading strategy but we do not have any idea how and when to use it.
Console Optimizer can help to pick up a right instrument and parameters to apply in the future.
So lets run the optimizer on all the instruments available on the account to find the most profitable of them.
We will use a standard strategy DMACD on the data of January 2017.

I made some automation to generate Console Optimizer project files.
Initially I prepared a project template based on the Optimizer documentation.
All the instrument-related data (the instrument itself, account currency, profit currency, contract currency, MMR) I replaced by variables like ${}.
(All the files mentioned here and below are included into file archive attached to this post).

To generate final project files I use Python (you need to have on the computer).
Data for the instruments I picked up from Trading Station by copying Simple Dealing Rates view data into text file.

Then I pasted the data into file names offers.txt. This filed is used by python script

So the python script iterates over the offers rows and populates the project template.
Also it generates a command file to run the optimizer with the all generated project files.
(I is assumed you have SDK installed in C:\Gehtsoft\IndicoreSDK3m otherwise you need to change the python file)
The command line is:
python dmacd_template.xml dmacd

After the script made its job we can go to the target folder and run the command file.

It will take a while to optimize the strategy for all the instruments.
The optimizer generates output files for each project containing the information about optimization process and result.
Code: Select all

I made another python script ( to parse the outputs to check out the results quickly:
python dmacd

Code: Select all
51696.0 NZD_USD
51654.1 XAU_USD
51618.5 EUR_GBP
51582.5 AUD_USD
51370.0 USD_CHF
51367.1 EUR_USD
51200.6 USOil
51082.2 USD_JPY
50998.9 EUR_NOK
50943.0 GER30
50904.4 USD_CAD
50890.2 EUR_JPY
50825.4 USD_CNH
50580.3 CAD_JPY
50534.2 GBP_JPY
50430.2 AUD_JPY
50375.0 FRA40
50313.9 US30
50219.2 EUR_CHF

So we can conclude NZD/USD shown the best performance with DMACD during January.
Lets open dmacd_template.xml_NZD_USD.stat to get the details:
Scroll down to find the best pass number:
Code: Select all
  <optimization-result success="true" pass-number="156"/>

Then find this pass in the same file:
Code: Select all
    <pass number="156" success="true" result="51696">
        <parameter name="SN" value="5" />
        <parameter name="LN" value="45" />
        <parameter name="IN" value="5" />
        <parameter name="limit" value="20" />
        <parameter name="stop" value="40" />
        <output-parameter name="trade-count" value="12" />
        <output-parameter name="profitable-trades" value="12" />
        <output-parameter name="loss-trades" value="0" />
        <output-parameter name="max-profit" value="259.306" />
        <output-parameter name="min-profit" value="3.16756" />
        <output-parameter name="total-profit" value="1695.95" />
        <output-parameter name="max-loss" value="0" />
        <output-parameter name="min-loss" value="0" />
        <output-parameter name="total-loss" value="0" />
        <output-parameter name="max-equity" value="52062.1" />
        <output-parameter name="min-equity" value="49819.9" />
        <output-parameter name="max-fall-equity" value="984.291" />
        <output-parameter name="final-equity" value="51585.2" />
        <output-parameter name="max-balance" value="51696" />
        <output-parameter name="min-balance" value="50000" />
        <output-parameter name="max-fall-balance" value="0" />
        <output-parameter name="final-balance" value="51696" />
        <output-parameter name="total-amount" value="120000" />

So this research should give us some trading ideas.

PS. The file archive with the python scripts and the optimizer input and output is attached to this post.