Using the Optimizer on a Stock Trading System

This topic contains 0 replies, has 1 voice, and was last updated by Seer Seer 7 years, 1 month ago.

Viewing 1 post (of 1 total)
  • Author
  • #627

    In this tutorial we will use the Optimizer on an already built trading system. We will be using the trading system Stochastics which contains one system with the following rules:

    Sell when the %k line crosses below the %d line from above the 80 Level.

    Buy when the %k line crosses above the %d line from below the 20 Level.

    We want the Optimizer to answer this question:

    What are the best levels to use with this system?

    Start Seer

    open Click on open. Load the example Stochastics. This can be found in the examples directory.

    open Click on the Bar event for the system to view the rules of the system.

    You will notice that the two bands are defined by the values 20 and 80. We need to create two variables to hold these values. We will first create the upper level.

    Click on the New Variable button. This window will open:


    1. Change the variable name to upper
    2. Set the default to 80
    3. Set the scope to symbol
    4. Tick Optimize this Variable
    5. Set the start to 60
    6. Set the Finish to 90
    7. Set the Step to 5
    8. Click OK to save your changes
    9. Change 80 to $upper in the bar event (Today($k)>80 becomes Today($k)>$upper)

    You have now declared the variable $upper so that the Optimizer can use it. If you now click Backtest, you will notice that the results are the same as before, this is becuase the default value is set at 80. When you click Optimize, Seer will run a backtest for each variation for all variables declared. In this case, Seer will run a backtest setting $upper=60, then run another backtest setting $upper=65 and so on until the last run, where $upper=90.

    If you now click on Optimize, you will notice that you have an additional grid with the results of each run. Clicking on any row will show the results in full in the top half of the window. If you click on the headings in the grid, Seer will sort the results by that heading. Right clicking in the grid will bring up a menu where you can export the results to Excel or to a file.

    Now create a variable called lower, with the start of 10, finish of 40 and a step of 5. Dont forget to set theOptimize this variable, and the default value (20). Now replace 20 with the variable $lower in the code and click on Optimize.

    You will notice that Seer has performed 49 backtests, since each variable changes 7 times.




    The charts and equity curve are for the last run. No output will be displayed for any run.

    Seer will let you Optimize any declared variable in any system and money management object. If you want to exclude a variable for the Optimize process just uncheck Optimize this variable.

    A Word of Warning

    As useful as the Optimizer is, you should be extremely suspicious of the results of any system that has passed through an Optimizer. All you have done is curve fit your system for the period of the test. The chances are that your Optimized variables will not be so “optimal” for other time periods…

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.