NNFX Algo Tester Help

How do I activate Optimization and how does it work?

Optimization allows you to run your backtest automatically several times, with a different configuration for each pass. This determines which combination of parameters produces the best result.

The NNFX Algo Tester allows you to optimize easily not only indicator settings but also any other variable parameters related to the algorithm, such as entry conditions, trading rules, and money management settings.

Some examples of questions that can be answered by using optimization:

  • Does my algorithm do better with the BRIDGE TOO FAR rule or without it?

  • Does ADX work better with a level of 25 or 30?

  • If using an SMA as a Baseline, what is the best period to choose?

  • Which is the best value for the Take Profit option: 1xATR, 1.5xATR or 2xATR?

  • Does a Trailing SL really improve results?

  • And much more...

To use this option you have to check the “Optimization” box in the Settings tab of the MT4 Strategy Tester.

The NNFX Algo Tester includes 25 inputs solely for optimizing indicator parameters. The parameters of any indicator may be optimized, including custom indicators. Any input that is either an integer, a decimal number, a boolean, or part of a dropdown list can be optimized.

To optimize an input of an indicator, just replace the input value with the name of the optimization input (INPUT_1 to INPUT_25). Then choose the optimization parameters (Start, Step and Stop) in the corresponding optimization input row and check the box next to it.

Value column: Indicates the value for a single backtest (without optimization).
Start column: Indicates the first value used in the first optimization test.
Step column: The step value between each optimization test.
Stop column: Indicates the last value used in the last optimization test.

Example: If you want to test 3 values for your SMA period (50, 75 and 100):

We must first choose one of the Optimization Inputs to replace the SMA period. We can choose any of the 25 available, but for simplicity we will choose INPUT_1.

We should then check the INPUT_1 box and fill in the columns Start, Step and Stop. (Since this is an optimization, we can leave the Value column at 0.)

Start = 50        Step = 25        Stop = 100

This will produce a 3-pass backtest using 3 different SMA values as follows:

First Optimization Test -> 50
Second Optimization Test -> 50+Step = 50+25 = 75
Third Optimization Test -> 75+Step = 75+25 = 100
Since 100 is the Stop value, the test will now end.

Note: The more parameters are optimized the longer an optimization will take.

After the optimization is finished, you can see the results of each backtest (pass) in the Optimization Results tab at the bottom of the MT4 Strategy Tester window.

The results include some of the most important parameters, as well as the settings for each pass. The "OnTester result" column will show the result of the parameter chosen for ON TESTER 1 (see What does "On Tester" mean?). The optimization results can also be exported to a CSV file, by selecting the EXPORT TO CSV FILE option during your configuration. In this case, more parameters will be shown, including a maximum of 6 ON TESTER values.

Some important notes:

  • To optimize boolean parameters (true/false) just check the respective box.
  • To optimize numerical parameters, choose the values to be optimized in the Start, Step, and Stop columns of your chosen INPUT line, and then check the respective box.
  • Be sure to check the boxes for each option you want to optimize.
  • It is possible to use the same optimization input on several different indicators in the same test, if appropriate.
  • If some results are not shown after the optimization ends then they may be being discarded (see I can't see all the results).

Optimization can be a powerful way to improve your algorithm, but over-optimization can be counter-productive because it can easily result in Curve Fitting.