TWM Wiki

Description

Optimizer

TWM comes with a WFO (walk forward optimization) module. Inside the module user is able set In-Sample and Out-Of-Sample periods to test strategy robustness. To access Optimizer proceed to Admin Panel → New → Optimizer

Creating a Test

To start testing, you need to create a test. To do so right-click in the left panel of the optimizer window

Next, you can choose to either:

- Open a previously saved test preset, or

- Create a new test from scratch, name your test and proceed to the next step

Image


In Sample (IS) Out of Sample (OS)

- In Sample (IS) Period: this is where your strategy optimization happens. The system tests different parameter combinations to find the best settings based on historical data.

- Out of Sample (OS) Period: this is where your optimized strategy is tested on "unseen" data. This period simulates real trading conditions and helps verify that your strategy wasn't just curve-fitted to historical data.

The next step is to create a testing period. Periods can be added:

- Manually by using Add Period in the same context menu or

- Using a special UI called Period Constructor.

This is made to allow users to see if the parameters found are optimal, robust, and that the strategy is not curve fitted.

If you need more explanation about In Sample or Out of Sample, we recommend this content:

Robert Pardo Podcast

Robert Pardo Book

Inside the period constructor it's easy to create an IS-OS period, and set the required lenght by either adjusting the day lenght or percentage in accordance with each other. For example, in the picture below we set a period of 365 days, where 30% or 110 days are dedicated to an out of sample period. If the last live period box is checked, the out of sample period will be ignored for the most recent period.

- Total Period Length: Set the overall timeframe (e.g., 365 days)

- IS Percentage: Choose what percentage should be In Sample (e.g., 70% = 255 days)

- OS Percentage: Choose what percentage should be Out of Sample (e.g., 30% = 110 days)

- Last Live Period: Check this box if you want the most recent period to skip OS testing

Image



You can add as many periods as you like. The optimization will take pleace through each period separately. At the end of the process you will see:

  1. Individual Results: Performance for each period
  2. Combined OS Results: Overall out-of-sample performance
  3. Simulation Results: Performance after OS periods (if enabled)
  4. Live Period Option: Most recent data for live trading preparation

Parameters

Once your periods are set up, you'll see them listed on the left side. The right side is where you configure your strategy parameters.

Setup Steps:

  1. Select Instrument: Choose the trading instrument (stock, forex pair, etc.)
  2. Select Strategy: Pick the trading strategy you want to optimize
  3. Configure Parameters: Right-click the three dots next to "Parameters" (refer to image for clarity)

For each parameter you want to optimize you'll see:

- Checkbox: Enable/disable optimization for this parameter

- Min: Starting value for optimization

- Max: Ending value for optimization

- Inc: Step size between values

For example let's take the following values:

Min= 5, Max= 100, Inc= 5 will test: 5, 10, 15, 20, 25... up to 100.

The system shows how many total combinations will be tested. Important information: if you see a very high number of combinations consider using the Generic Optimization engine for faster results.

Image


Results

To start optimization process, click the RUN botton. Depending on your settings this may take some time.

Understanding your results:

After the optimization has finished, by clicking on the periods root, you'll see combined Out of Sample results. The red vertical lines mark the end of each OS period.

Image


Matrix Tab:

Here you can review specific parameters that were found for each particular period.

  1. At periods root: shows which parameters were found for each period
  2. At specific period: shows parameters used for each strategy iteration.

By clicking on the matrix tab for a specific period you will see what specific parameters were used for a specific iteration listed in the best strategies list.

Image


Best strategies:

The optimizer ranks strategies based on your chosen fitness parameters, such as profit factor, net profit, sharpe, etc. You can check the list by looking at the keep best strategy parameter. By default there will be 10, and the optimizer will always choose the best one. The optimization fitness parameter, is an extendable module that can be coded by the user or users can use some of the available presets.


View top performers: Default shows top 10 strategies

Change selection: Click different strategies to see updated OS results

Access additional options: Right-click for more features:

  1. Preset - Save: will save the particular strategy present to be used on chart, in Validator or Optimizer.
  2. Settings: control which columns are displayed
  3. Open Validator: test specific periods in the validator tool
  4. View Parameter list: see all parameters in table format

If you change the chosen best strategy in the top list the OS will reexecute so you can check an updated, and combined Out of Sample result. You can toggle through the tabs to see different results. Main tabs are:

IS Tab: In Sample results only

OS Tab: Out of Sample results only

Total Tab: combined IS + OS results

Sim Tab: will show results for a period that happend after OS ended, if Sim is enabled then Total will show IS+OS+Sim results. (if Sim is disable the tab will not show it)


To enable Simulation: Admin Panel → Tools → Options → Calculations → Calculate Simulation

Some results may be excluded based on some global filtering set during the optimization. The two available global filters are:

- Min Trades IS: Minimum number of trades that have to occur in the In Sample period, in order for it to be considered

- Draw Down Level: Maximum allowable drawdown during In Sample period

If the execution is filtered, you will see the count for the filtered executions INFO tab at the top.

Image


Optimizer Types

The two main types available are:

  1. Default - which will an exhaustive optimzier that will go through every single combination that you have created
  2. Genetic - will use a genetic algorithm (the open source code for the genetic algorithm is provided in the custom project)

The settings for the genetic algorithm will come up below the parameters section. Please click on the arrow for them to unfold. Each parameter will light up with a small caption helping to understand its purpose.

Database

When you find optimization results you want to keep:

  1. Right-click the periods section
  2. Select "Save Results"
  3. Your results are stored for future reference

Accessing Saved Results

Navigate to Admin Panel → New → Database to view all saved optimization results.

Features:

  1. Results are saved in static form with best strategies for each period
  2. Double-click any saved strategy to open it in optimizer static window mode

Perfect for comparing different optimization runs or sharing results

Image


Video Tutorial



This website uses cookies to enhance your browsing experience. By continuing to use our website, you agree to our Privacy Policy

Necessary cookies help make a website usable by enabling basic functions such as page navigation and access to protected areas of the site.

  • Necessary cookies

    .AspNet.Consent

    Indicates whether the user has consented to the use of necessary cookies.

    Maximum storage duration: 1 Year | Type:Necessary cookies
    .AspNetCore.Antiforgery

    Used to prevent CSRF attacks and protect user data.

    Maximum storage duration: Session | Type: Necessary cookies
    .AspNetCore.Cookies

    Used to manage authentication information and the user's session.

    Maximum storage duration: 1 Year | Type: Necessary cookies
    .AspNetCore.Culture

    Used to store user's language preferences.

    Maximum storage duration: 1 Year | Type: Necessary cookies
    __Secure-OSID

    Security cookie set by Google to authenticate users and prevent fraudulent use of login credentials.


    Maximum storage duration: 6 Months | Type: Necessary cookies
    __Host-3PLSID

    Ensures you stay connected to your Google accounts across various services.

    Maximum storage duration: 2 Years | Type: Necessary cookies
    AEC

    Used to verify your Google account and ensure that requests in sessions come from you.

    Maximum storage duration: 6 Months | Type: Necessary cookies
    HSID

    Security cookie used by Google to authenticate users and prevent fraudulent use of login credentials, protecting user data.

    Maximum storage duration: 2 Years | Type: Necessary cookies
    SEARCH_SAMESITE

    This cookie prevents the browser from sending the cookie along with cross-site requests, helping to mitigate the risk of cross-origin information leakage.

    Maximum storage duration: 6 Months | Type: Necessary cookies
    SID

    Important for Google's security and to ensure that Google can authenticate the account and block fraudulent access attempts.

    Maximum storage duration: 2 Years | Type: Necessary cookies
    SIDCC

    Security cookie to protect user data from unauthorized access.

    Maximum storage duration: 1 Year | Type: Necessary cookies
    __Host-1PLSID, __Host-3PLSID

    Crucial cookies to ensure that you remain securely logged into your Google accounts while accessing various Google services.

    Maximum storage duration: 2 Years | Type: Necessary cookies

Functional cookies allow the website to provide enhanced functionality and personalization. They may be set by the website owner or by third parties whose services have been added to the pages.

  • Functional Cookies

    LSOLH

    Used by Google to store session information and enhance the user's experience on Google services.


    Maximum storage duration: Session | Type: Functional Cookies
    COMPASS

    Used by Google to improve user navigation by remembering preferences and information, such as preferred language.

    Maximum storage duration: 6 Months | Type: Functional Cookies
    ACCOUNT_CHOOSER

    Remembers which accounts have been used to log into Google services on the device.

    Maximum storage duration: 1 Year | Type: Functional Cookies
    APISID

    Used by Google to store user preferences and information when viewing pages with Google maps.

    Maximum storage duration: 2 Years | Type: Functional Cookies
    LSID

    Used by Google to store user preferences while viewing pages that incorporate Google services.

    Maximum storage duration: 2 Years | Type: Functional Cookies
    NID

    Used by Google to remember user preferences, such as preferred language, to provide a more personalized experience.

    Maximum storage duration: 6 Months | Type: Functional Cookies
    SAPISID

    Used by Google to collect information about visitors for videos hosted on YouTube or maps integrated with Google Maps.

    Maximum storage duration: 2 Years | Type: Functional Cookies
    __Host-GAPS

    Used by Google to store user preferences and information when pages containing maps or Google services are viewed.

    Maximum storage duration: 2 Years | Type: Functional Cookies

Statistical cookies help website owners understand how visitors interact with the site by collecting and transmitting information anonymously.

  • Statistical Cookies

    CLID

    Unique identifier used to track user interactions and maintain unique sessions.


    Maximum storage duration: 1 Year | Type: Statistical Cookies
    MR

    Microsoft cookie that collects data on user interactions to improve services.

    Maximum storage duration: 7 days | Type: Statistical Cookies
    SM

    Used by the Microsoft Clarity analytics suite to maintain the user's session.

    Maximum storage duration: Session | Type: Statistical Cookies

Marketing cookies are used to track visitors on websites. The intent is to display relevant and engaging ads for the individual user.

  • Marketing Cookies

    AID

    Used by Google to link your activity across devices if you have logged in with the same Google account.


    Maximum storage duration: 1 Year | Type: Marketing Cookies
    ANONCHK

    Used by Microsoft Advertising to check the anonymity of data sent by tracking cookies.

    Maximum storage duration: 10 minutes | Type: Marketing Cookies
    MUID

    Microsoft cookie used to track user interactions across Microsoft domains.

    Maximum storage duration: 13 Months | Type: Marketing Cookies
    __Secure-3PSID, __Secure-3PAPISID, __Secure-3PSIDTS, __Secure-3PSIDCC

    Google cookies designed to build a profile of your preferences and show you relevant ads on other sites, protecting the Google account.

    Maximum storage duration: 2 Years | Type: Marketing Cookies
    ADS_VISITOR_ID

    Used by Google to identify and track visitors across various websites to display personalized advertising.

    Maximum storage duration: 2 Years | Type: Marketing Cookies
    OTZ

    Used by Google to personalize ads on Google properties, like Google Search.

    Maximum storage duration: 1 Month | Type: Marketing Cookies
    __Secure-1PAPISID, __Secure-1PSID

    Used by Google to deliver more relevant ads and protect the security of your preferences and Google account information.

    Maximum storage duration: 2 Years | Type: Marketing Cookies

Cookies are small text files that can be used by websites to make the user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies, we need your permission. This means that cookies classified as necessary are processed under Article 6(1)(f) of the GDPR. All other cookies, namely those belonging to the categories of preferences and marketing, are processed under Article 6(1)(a) of the GDPR.

This site uses different types of cookies. Some cookies are placed by third-party services that appear on our pages.

You can change or revoke your consent at any time from the Cookie Statement on our website.

Learn more about who we are, how you can contact us, and how we process personal data in our Privacy Policy.

Specify your consent ID and the date you contacted us regarding your consent.