×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search

Performing Optimization

3,388 bytes added, 10:15, 23 February 2022
Once [[Understanding_Strategies|a strategy has been [[<span style="color: red;">'''LINK'''</span>0280_Backtesting/22-8002_Signals.html name="1"; |applied]] to a chart, strategy optimization can be performed.
<br>
To perform Exhaustive Search optimization:
# :1. Open the '''Format Objects''' window.<br><span>{{FormatObjectIS}}</span># :2. Select the '''Signals''' tab.# :3. Click the '''Optimize''' button.# :4. In the '''Select Choose the Optimization MethodType''' dialog box that appears, select '''Exhaustive SearchRegular Optimization''' and click '''Next'''.# :5. In the '''Exhaustive Search PropertiesSet Optimizable Inputs''' window that opens, select section check/uncheck the check box to the left of the signal name and input name to enable/disable optimization for this input or check the check box to the left of the '''Optimizable InputsSignal Name''' column heading to enable optimization for all inputs (at least one input should be selected to perform optimization). :6. The '''Current Value''' tabcolumn shows input values that are currently selected for the signals applied on the chart.# :7. In the '''Start Value''' column, enter the desired starting values for each of the inputs.# :8. In the '''End Value''' column, enter the desired ending values for each of the inputs.# :9. In the '''Step''' column, enter the desired step size, for each of the inputs.# Select the :10. The '''Optimization CriteriaStep Count''' tabcolumn shows current number of steps for an input.# :11. Select the '''Use LimitationExhaustive''' checkbox to limit the output to a defined number of the best results; unselect the checkbox to list all the results radio button in the optimization report'''Set Optimization Method''' section.# Enter :12. Select the desired number of best results target function to be optimized in the '''Show <i>N</i> best resultsOptimize by''' box.section:# Select the best results criteria in In the '''best results forMaximal/Minimal''' list box, set the respective values to be selected at the end of optimization.# Select criteria:From the next list one can select the function itself.#: 1. Select <br>If '''Standard Custom Criteria'''is selected, Edit button is available.#: 2. Select Press it to write the script for the custom criteria from the drop-down list. [[Performing_Optimization#Standard Custom Criteria|Read more about Standard and Custom Criteria]].<br>or:<br>#: 1. Select In order to apply the desired function from code select '''Custom CriteriaFitness Value'''. The custom value shall be specified by [[SetCustomFitnessValue]] keyword in the script.#: 213. Click Select the '''Edit...Use Limitation''' button.#: 3. Write checkbox to limit the output to a defined number of the best results; unselect the checkbox to list all the script for results in the custom criteria. [[Performing_Optimization#Custom Criteria|Read more about Custom Criteria]]optimization report.#: 414. Click When '''OKUse Limitation'''checkbox is checked Optimization dialog window shows current best results for selected сriteria during optimization.# Select :15. Click '''AscendingOptimize''' or N '''Descendingcombinations''' option to sort run the optimization and generate the output in ascending or descending order, respectivelyOptimization Report.<br><div style="background-color: # Click E3FBE5;">Since '''OKMultiCharts 10''' that is possible to run the start optimization and generate from '''Chart Analysis''' toolbar (see [[MultiCharts_Work_Area#Hiding_and_Redisplaying_Toolbars]]) by clicking on the Optimization Report'''Optimize Strategy''' button: [[File:toolbar2_ChartAn_125.png]]</div>
<br>
<br>
== Running Genetic Algorithm Search ==
To perform Genetic Algorithm optimization:
:1. Open the '''Format Objects''' window.<br><span>{{FormatObjectIS}}</span>
:2. Select the '''Signals''' tab.
:3. Click the '''Optimize''' button.
:4. In the '''Choose the Optimization Type''' dialog box that appears, select '''Regular Optimization''' and click '''Next'''.
:5. In the '''Set Optimizable Inputs''' section check/uncheck the check box to the left of the signal name and input name to enable/disable optimization for this input or check the check box to the left of the '''Signal Name''' column heading to enable optimization for all inputs (at least one input should be selected to perform optimization).
:6. The '''Current Value''' column shows input values that are currently selected for the signals applied on the chart.
:7. In the '''Start Value''' column, enter the desired starting values for each of the inputs.
:8. In the '''End Value''' column, enter the desired ending values for each of the inputs.
:9. In the '''Step''' column, enter the desired step size, for each of the inputs.
:10. The '''Step Count''' column shows current number of steps for an input.
:11. Select '''Genetic''' radio button in the '''Set Optimization Method''' section.
:12. Selecting the target function to be optimized in the '''Optimize by:''' section:
In the '''Maximal/Minimal''' list, set the respective individuals, which will take part in further selection and crossover, for the selected parameter.
From the next list one can select the function itself.
<br>If '''Custom Criteria''' is selected, Edit button is available. Press it to write the script for the custom criteria. [[Performing_Optimization#Custom Criteria|Read more about Standard and Custom Criteria]].
<br>In order to apply the desired function from code select '''Custom Fitness Value'''. The custom value shall be specified by [[SetCustomFitnessValue]] keyword in the script.
# Open the '''Format Objects''' window:13.<br><span>{{FormatObjectIS}}</span># Select the '''Signals''' tabSet Basic Genetic Algorithm Parameters.# Click the '''Optimize''' button:14.# In An optimum population size value is automatically placed next to the '''Select Optimization MethodSet Population Size''' dialog box that appears; if a different value is desired, select check '''Genetic AlgorithmSet Population Size'''.# In the '''Genetic Algorithm Properties''' window that opens, box and select the '''Optimizable Inputs''' tabvalue.# :15. In the '''Start ValueCrossover Probability''' columnfield, enter select the desired starting values for each crossover probability; value range is 0-1, with a default of the inputs0.95.# :16. In the '''End ValueMutation Probability''' columnfield, enter select the desired ending values for each mutation probability; value range is 0-1, with a default of the inputs0.05.# :17. In the '''StepConvergence Type''' columnsection, enter the desired step size, for each of the inputs.# Select the select '''Algorithm-specific PropertiesNumber of Generations''' tab.# Select criteria:#: 1. Select or '''Standard CriteriaProximal Convergence'''.#: 218. Select the criteria from the drop-down list. [[Performing_Optimization#Standard Criteria|Read more about Standard Criteria]].<br>or:<br>#: 1. Select If '''Custom CriteriaNumber of Generations'''.is selected:#: 2. Click In the '''Edit...Number of Individuals in Population for Crossover''' button.#: 3. Write field, enter the script desired number of individuals in population for the custom criteria. [[Performing_Optimization#Custom Criteria|Read more about Custom Criteria]]crossover.#: 4. Click <br>In the '''OKMaximum Number of Generations'''field, enter the desired maximum number of generations.<br><div style="background-color: # Select '''Ascending''' or '''Descending''' option to sort E3FBE5;">Note: the output above fields are grayed out if “Set Population Size” box is not checked in ascending or descending order, respectivelyBasic Genetic Algorithm Parameters.</div># An optimum population size value is automatically placed into the :19. If '''Population SizeProximal Convergence''' box; if a different value is desired, enter the value into the box.selected: # In the '''Number of Individuals in Population for Crossover Probability''' boxfield, enter the desired number of individuals in population for crossover probability; value range is 0.95-0.99, with a default of 0.95.# <br>In the '''Mutation ProbabilityMaximum Number of Generations''' boxfield, enter the desired mutation probability; value range is 0.01-0.05, with a default maximum number of 0.05generations. # <br>In the '''Convergence Type''' drop-down list, select '''Minimal Number of Generations''' or '''Proximal Convergence'''.# In the '''Maximum Number of Generations''' boxfield, enter the desired maximum minimal number of generations.<br><div style="background-color: # E3FBE5;">Note: the above fields are grayed out if “Set Population Size” box is not checked in Basic Genetic Algorithm Parameters.</div>:20. If '''Proximal Convergence ''' was selected, enter the desired minimum number of generations and convergence rate into the respective boxesfield. A value, approaching 1 is usually selected for the convergence rate; the default value is 0.99000099.# :21. In the '''Genetic Algorithm Subtype''' drop-down listsection, select '''Basic''' or '''Incremental''' algorithm subtype. # :22. If Basic algorithm subtype was selected, select '''Yes''' or '''No''' for '''Use Elitism''' option.# :23. If Incremental algorithm subtype was selected, select the '''Replacement Scheme''' between Worst, Parent and Random.:24. Click '''Offspring NumberOptimize''' (number of “children”). # Click N '''OKcombinations''' to run the optimization and generate the Optimization Report.:25. Optimization dialogue window shows Average fitness value for current population during optimization.
<br>
<div style== Standard Criteria ==Standard Criteria lets the user select a criterion from a pre"background-defined list.  For example, if the user selects Net Profit, the color: #E3FBE5;">Since '''MultiCharts 10''' that is possible to start optimization will find the parameters that generate from '''Chart Analysis''' toolbar (see [[MultiCharts_Work_Area#Hiding_and_Redisplaying_Toolbars]]) by clicking on the highest Net Profit'''Optimize Strategy''' button: [[File:toolbar2_ChartAn_125.png]]</div>
<br>
== Custom Criteria ==
There are two types of criteria: standard and custom.<br>Standard Criteria lets the user select a criterion from a pre-defined list. For example, if the user selects Net Profit, the optimization will find the parameters that generate the highest Net Profit.<br>Custom Criteria lets the user create his own criteria. Instead of choosing from a pre-defined list like in [[Performing_Optimization#Standard Criteria|Standard Criteria]], the user can script his own criteria. E.g., suppose the user wants to find the parameters that maximize the Net Profit / Max Drawdown ratio. This ratio isn't pre-defined under [[Performing_Optimization#Standard Criteria|Standard Criteria]], so it won't be in the drop-down list. However, this ratio can be created using Custom Criteria.
It is also possible to add additional criteria such as number of trades and winning percentage.
E.g., it is possible to specify: '''''the result have more than 300 trades and a winning percentage that's greater than 50%'''''.
<br><span style="background-color: #E3FBE5;">The scripting language is '''JavaScript'''.</span>
|align="center"|Yes
|-
|Gross LossGrossLoss
|Gross Loss
|align="center"|Yes
|align="center"|Yes
|-
|Percent ProfitablePercentProfitable
|% Profitable
|align="center"|Yes
|align="center"|Yes
|-
|Winning TradesWinningTrades
|Winning Trades
|align="center"|Yes
|align="center"|Yes
|align="center"|No
|-
|CustomFithessValue
|Last [[SetCustomFitnessValue|SetCustomFitnessValue()]] calculation result.
Will return 0 if [[SetCustomFitnessValue|SetCustomFitnessValue()]] was not calculated.
|align="center"|Yes
|align="center"|Yes
|}
<br>
 
== Pausing optimization ==
 
Since '''MultiCharts 10''' that is possible to pause the optimization process in order to temporary decrease the load on the CPU. To pause optimization click '''Pause''' in the '''Optimization Progress''' window. To resume optimization click '''Resume'''.
<br>
[[Category:Optimization]]

Navigation menu