Optimization Algorithm scripts are used to control the optimization process. During optimization the Desktop and its strategies will be backtested repeatedly with different optimization vectors (script parameter values) as selected by the Optimization Algorithm script.


Setup


An Optimization Algorithm script can be set up from the Optimization Settings Window of the Desktop.


Functions


Name

Description

OnInitialize()

This function is used for accepting the script parameters and for initializing the script prior to all other function calls. Once the script is assigned to a Desktop, its parameter values can be specified by the user.

int[] OnSelectNextOptimizationVectors()

This function is called in order to select the next optimization vectors to be processed. The function may be called multiple times in a row before the OnUpdateOptimizationVector function is called.

int OnGetMaxVectors()

This function is called to get the number of optimization vectors that the algorithm will select and run if the optimization process runs to completion.

OnUpdateOptimizationVector(int)

This function is called to notify the optimization algorithm that a vector has been processed.

OnShutdown()

This function is called when the script is shutdown.


Function Details


OnInitialize()

This function is used for accepting the script parameters and for initializing the script prior to all other function calls. Once the script is assigned to a Desktop, its parameter values can be specified by the user.


int[] OnSelectNextOptimizationVectors()

This function is called in order to select the next optimization vectors to be processed. The function may be called multiple times in a row before the OnUpdateOptimizationVector function is called.


Returns


The indexes of the next optimization vectors to process.


int OnGetMaxVectors()

This function is called to get the number of optimization vectors that the algorithm will select and run if the optimization process runs to completion.


Returns


The maximum number of optimization vectors to be run.


OnUpdateOptimizationVector(int vectorIndex)

This function is called to notify the optimization algorithm that a vector has been processed.


Parameters


Type

Identifier

Description

int

vectorIndex

The vector index of the optimization vector that has been processed


OnShutdown()

This function is called when the script is shutdown.