In trading, a solution is a particular set of trading rules and perhaps system parameters.

All trading systems have at least two rules (an entry rule and an exit rule), and most have one or more parameters. Rules express the logic of the trading system, and generally appear as “if-then” clauses in whatever language the trading system has been written.

Parameters determine the behavior of the logic expressed in the rules; they can include lengths of moving averages, connection weights in neural networks, thresholds used in comparisons, values that determine placements for stops and profit targets, and other similar items.

A simple moving-average crossover system, for example, had two rules: one for the buy order and one for the sell order. It also had a single parameter, the length of the moving average. Rules and parameters completely define a trading system and determine its performance.

To obtain the best performance from a trading system, parameters may need to be adjusted and rules juggled. There is no doubt that some rule and parameter combinations define systems that trade well, just as others specify systems that trade poorly; i.e., solutions differ in their quality.

The goodness of a solution or trading model, in terms of how well it performs when measured against some standard, is often called fitness. The converse of fitness, the inadequacy of a solution, is frequently referred to as cost.

In practice, fitness is evaluated by a fitness function, a block of programming code that calculates a single number that reflects the relative desirability of any solution. A fitness function can be written to appraise fitness howsoever the trader desires. For example, fitness might be interpreted as net profit penalized for excessive drawdown.

A cost function works in exactly the same way, but higher numbers signify worse solutions. The sum of the squared errors, commonly computed when working with linear regression or neural network models, is a cost function.

The best possible solution to a problem can now be defined: It is that particular solution that has the greatest fitness or the least cost. Optimizers endeavor to find the best possible solution to a problem by maximizing fitness, as measured by a titness function, or minimizing cost, as computed by a cost function.

The best possible solution to a problem may be discovered in any number of ways. Sometimes problems can be solved by simple trial-and-error, especially when guided by human insight into the problem being worked.

Alternatively, sophisticated procedures and algorithms may be necessary. For example, simulating the process of evolution (as genetic optimizers do) is a very powerful way to discover or evolve high-quality solutions to complex problems.

In some cases, the best problem solver is an analytic (calculus-based) procedure, such as a conjugate gradient. Analytic optimization is an efficient approach for problems with smooth (differentiable) fitness surfaces, such as those encountered in training neural networks, developing multiple linear regression models, or computing simple-structure factor rotations.