TrainMode

Training method; affects the way how parameters and factors are generated in the training process. The following flags can be set :

Range:

ASCEND Ascend optimization (default). Walks through all parameter ranges and seeks for 'plateaus' in the parameter space, while ignoring single peaks. This is normally the best algorithm for generating a robust strategy.
BRUTE Brute force optimization, for special purposes (Zorro S required). Evaluates all possible parameter combinations and selects the most profitable combination that is not a single peak. This algorithm will likely overfit the strategy, so out-of-sample or walk-forward testing is mandatory.
GENETIC Genetic optimization, for special purposes (Zorro S required). A population of parameter combinations is evolved toward the best solution in an iterative process. In each iteration, the fittest - i.e. most profitable - individuals are stochastically selected, and their parameters are then pair-wise recombined and randomly mutated to form a new generation. This algorithm can be useful when a large number of parameters per component must be optimized.
TRADES Optimize considering the trade sizes (Lots). Large trades get more weight. Otherwise trade sizes are ignored in the training process.
PHANTOM Optimize ignoring phantom trades. Otherwise phantom trades are treated as normal trades in the training process.
PEAK Optimize toward the highest peak in the parameter space, rather than toward hills or plateaus. This can generate unstable strategies and is for special purposes only.
ALLCYCLES Generate individual OptimalF factor files for all WFO cycles, instead of a single file for the whole simulation. This reduces the factor quality due to less trades, but prevents backtest bias.

NumParameters

Number of parameters to optimize in the current loop in training mode (read/only).

ParCycle

Current parameter or current generation, runs from 1 to NumParameters in Ascend mode, or from 1 to Generations in Genetic mode (read/only).

StepCycle

Number of the optimize cycle, starting with 1 (read/only).

StepNext

Set this to 0 for aborting the optimization.

Population

Maximum population size for the genetic algorithm (default = 50). Any parameter combination is an individual of the population. The population size reduces automatically when the algorithm converges and only the fittest individuals and the mutants remain.

Generations

Maximum number of generations for the genetic algorithm (default = 50). Evolution terminates when this number is reached or when the overall fitness does not increase for 10 generations.

MutationRate

Average number of mutants in any generation, in percent (default = 5%). 

CrossoverRate

Average number of parameter recombinations in any generation, in percent (default = 80%).

Type:

int

Remarks:

Example:

setf(TrainMode,TRADES+PEAK);

See also:

mode, optimize, OptimalF, TrainCycle, setf, resf
► latest version online