GB Users Guide

Embed Size (px)

Citation preview

  • 8/13/2019 GB Users Guide

    1/84

    Genetic Builder

    User's Guide

    Version 2.1.0 Last updated: 19.6.2012

  • 8/13/2019 GB Users Guide

    2/84

    Genetic Builder User's Guide

    2

    Copyright

    All rights reserved.

    The Genetic Builder software, bonus strategies and content of this Manual is copyrighted.

    You can use them only with valid license.

    No part of this publication may be reproduced, stored in a retrieval system, or transmitted in

    any form or by any means - including electronic, mechanical, photocopy, recording, scanning or

    otherwise - without the prior written permission of the author.

    2012 Mark Fric, SonarBytes Ltd

    SupportIf you'll have trouble understanding anything, you need help, or you simply have some question

    to ask (related to the system), remember your purchase includes also a support.

    We are here for you, contact us at:

    www.GeneticBuilder.com/web/contactus/

    http://www.geneticbuilder.com/contactushttp://www.geneticbuilder.com/contactushttp://www.geneticbuilder.com/contactus
  • 8/13/2019 GB Users Guide

    3/84

    Genetic Builder User's Guide

    3

    Risk Disclosure

    Risk Disclosure Statement

    Trading any financial market involves risk. This Manual is neither a solicitation nor an offer to Buy/Sell any

    financial product. The contents of this Manual are for general informational purposes only.

    Although every attempt has been made to ensure accuracy, the author does not give any expressed or implied

    warranty as to its accuracy. The author does not accept any liability for error or omission. All examples are

    provided for illustrative purposes only and should not be construed as investment advice.

    No representation is being made that any account, or trader will, or is likely to achieve profits or loses similar to

    those discussed in this Manual. Past performance cannot be relied upon as being indicative of future

    performance.

    The information provided in this Manual is not intended for distribution to, or use by any person or entity in

    any jurisdiction or country where such distribution or use would be contrary to law or regulation or which

    would subject the author to any registration requirement within such jurisdiction or country.

    Hypothetical performance results have many inherent limitations, some of which are mentioned below. No

    representation is being made that any account will or is likely to achieve profits or losses similar to those

    shown. In fact, there are frequently sharp differences between hypothetical performance results and actual

    results subsequently achieved by any particular trading system.

    One of the limitations of hypothetical performance results is that they are generally prepared with the benefit

    of hindsight. In addition, hypothetical trading does not involve financial risk and no hypothetical trading record

    can completely account for the impact of financial risk in actual trading.

    For example the ability to withstand losses or to adhere to a particular trading program in spite of the trading

    losses are material points, which can also adversely affect trading results. There are numerous other factors

    related to the market in general or to the implementation of any specific trading program, which cannot be

    fully accounted for in the preparation of hypothetical performance results. All of which can adversely affect

    actual trading results.

    U.S. Government Required Disclaimer - Commodity Futures Trading Commission Futures, Currency and Options

    trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing

    to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford

    to lose. This is neither a solicitation nor an offer to Buy/Sell futures or options. No representation is being made

    that any account will or is likely to achieve profits or losses similar to those discussed on this web site. The past

    performance of any trading system or methodology is not necessarily indicative of future results.

    CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE

    AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE

    THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE

    IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING

    PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF

    HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT

    OR LOSSES SIMILAR TO THOSE SHOWN.

  • 8/13/2019 GB Users Guide

    4/84

    Genetic Builder User's Guide

    4

    Software License Agreement

    This legal document is an agreement between you, the end user ('User'), and Sonarbytes ('Author').

    AGREEMENT - By installing Genetic Builder ('Software'), copying the Software and/or clicking on the 'I Agree'

    button during installation, you agree to all of the terms of this software license agreement ('Agreement').If you do not agree with all of the terms of this agreement, click on the 'I Do Not Agree' button and/or do not

    install, copy or otherwise use the software.

    INTELLECTUAL PROPERTY. The Software and any associated materials are protected by copyright law.

    The package is a proprietary product of the Author. The Author retains title to and ownership in the copyright

    of the software program and the associated materials. You acknowledge that the Author owns all rights, title

    and interest in and to the Software, including without limitation all Intellectual Property Rights.

    'Intellectual Property Rights' means any and all rights existing from time to time under patent law, copyright

    law, trade secret law, trademark law, unfair competition law, and any and all other proprietary rights, and any

    and all applications, renewals, extensions and restorations thereof, now or hereafter in force and effect

    worldwide. You agree not to modify, adapt, translate, decompile, reverse engineer, disassemble or otherwise

    attempt to derive source code from the Software.

    REGISTRATION. This program is neither freeware nor public domain. Use requires valid license.

    Contact us at http://www.geneticbuilder.com/contactus/ for bulk licenses or discounted prices.

    GRANT. Author hereby grants you a non-exclusive, non-transferable license to use the Software upon payment

    of the License Fee until the expiry date of the license (if any). Author makes no guarantee of the frequency,

    value, applicability or content of future updates or modifications to the Software. The Software will only be

    made available to you in electronic form for download.

    The requirement to pay a license fee does not apply to evaluation copies for which Author does not charge a

    license fee. Evaluation licenses expire 14 calendar days from the date of this agreement, unless otherwise

    agreed to in writing by Author. On the date of expiry of the license, User agrees to either purchase the

    Software at the list price in force at that time or to destroy all copies of the Software in electronic or other

    form, including any copies on backup tapes or other media.

    User's use of the Software shall be limited to use on a single hardware chassis, on a single central processing

    unit, as applicable, or use on such greater number of chassis or central processing units as User may have paid

    the required license fee.

    You may not: permit other individuals to use the Software except under the terms listed above; translate,

    reverse engineer, decompile, decrypt, reverse engineer, disassemble (except to the extent applicable laws

    specifically prohibit such restriction), or create derivative works based on the Software; copy the Software

    (except for back-up purposes); rent, lease, transfer, assign, sub-license or otherwise transfer rights to theSoftware; or remove any proprietary notices or labels on the Software.

    DISCLAIMER OF WARRANTY. THE SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY

    KIND, INCLUDING WITHOUT LIMITATION THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR

    PURPOSE AND NON-INFRINGEMENT. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF

    THE SOFTWARE IS BORNE BY YOU.

    LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR

    OTHERWISE, SHALL AUTHOR OR ITS SUPPLIERS OR RESELLERS BE LIABLE TO YOU OR ANY OTHER PERSON FOR

    ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL OR PUNITIVE DAMAGES OF ANY CHARACTER

    INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER

    FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES. IN NO EVENT WILLAUTHOR BE LIABLE FOR ANY DAMAGES IN EXCESS OF AUTHOR'S LIST PRICE FOR A LICENSE TO THE SOFTWARE,

    EVEN IF AUTHOR SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY

  • 8/13/2019 GB Users Guide

    5/84

    Genetic Builder User's Guide

    5

    ANY OTHER PARTY. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL

    INJURY TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. FURTHERMORE, SOME STATES DO NOT

    ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION

    AND EXCLUSION MAY NOT APPLY TO YOU.

    TERMINATION. This license will terminate automatically if you fail to comply with the limitations described

    above. On termination, you must destroy all copies of the Software in electronic or other form, including anycopies on backup tapes or other media. Upon termination of this License for any reason, you shall have no right

    to refund of the whole or part of any License Fee paid.

  • 8/13/2019 GB Users Guide

    6/84

    Genetic Builder User's Guide

    6

    Table of Contents

    1 Introduction ..................................................................................................................................... 8

    1.1 What is Genetic Builder? ......................................................................................................... 8

    1.2 Is Genetic Builder Right for You? ............................................................................................. 8

    1.3 What to Expect ........................................................................................................................ 9

    1.4 Evaluating Generated Strategies ........................................................................................... 10

    1.5 Backtesting issues .................................................................................................................. 13

    1.6 Requirements ........................................................................................................................ 15

    1.6.1 Installation ..................................................................................................................... 15

    1.7 New Features......................................................................................................................... 16

    2 How does it work? ......................................................................................................................... 18

    2.1 Random generation of trading strategies ............................................................................. 18

    2.2 Genetic Evolution .................................................................................................................. 19

    2.3 Supported building blocks ..................................................................................................... 20

    2.4 Custom Indicators.................................................................................................................. 21

    2.5 Modes of operation ............................................................................................................... 222.5.1 Genetic Evolution .......................................................................................................... 22

    2.5.2 Random Generation ...................................................................................................... 22

    2.5.3 "Mixed" mode ............................................................................................................... 23

    2.5.4 Strategy Testing ............................................................................................................. 23

    3 Quick start with the program ........................................................................................................ 24

    3.1 Main concepts ....................................................................................................................... 24

    3.2 Flow of work .......................................................................................................................... 26

    3.3 Random Generation in step-by-step examples ..................................................................... 27

    3.3.1 Step 1: Obtaining history data for backtest .................................................................. 27

    3.3.2 Step 2: Configuring the build process ............................................................................ 273.3.3 Step 3: Starting the generation ..................................................................................... 32

    3.3.4 Step 4: Stopping the generation and reviewing the results ......................................... 33

    3.3.5 Summing it up................................................................................................................ 35

    4 Detailed Description ...................................................................................................................... 36

    4.1 Data tab ................................................................................................................................. 36

    4.1.1 Data for backtest ........................................................................................................... 36

    4.1.2 Manage History Data ..................................................................................................... 36

    4.1.3 Manage Custom Indicators ........................................................................................... 37

    4.2 Build tab ................................................................................................................................ 38

    4.3 Settings tab ............................................................................................................................ 394.3.1 Build Goals ..................................................................................................................... 39

    4.3.2 Strategy Options Screen ................................................................................................ 41

    4.3.3 Building Blocks Screen ................................................................................................... 43

    4.3.4 Genetic Options Screen ................................................................................................. 47

    4.3.5 Strategy Ranking Options Screen .................................................................................. 51

    4.4 Results tab ............................................................................................................................. 55

    4.4.1 Databank ....................................................................................................................... 56

    4.4.2 Result Details ................................................................................................................. 59

    4.5 Strategy Editor ....................................................................................................................... 63

    5 How To........................................................................................................................................... 64

    5.1 Export strategy from Genetic Builder and test it in MetaTrader .......................................... 64

  • 8/13/2019 GB Users Guide

    7/84

    Genetic Builder User's Guide

    7

    5.2 Import history data from Metatrader ................................................................................... 68

    5.3 Importing tick data from MetaTrader ................................................................................... 71

    5.4 Importing custom indicator from MetaTrader to GB ............................................................ 73

    5.4.1 Step 1 - Getting the indicator values from MetaTrader ................................................ 73

    5.4.2 Step 2 - Exporting the indicator values from MetaTrader ............................................ 76

    5.4.3 Step 3 - Create new custom indicator in Genetic Builder ............................................. 77

    5.4.4 Step 4 - Import indicator values to Genetic Builder ...................................................... 78

    5.4.5 Step 5 - Use the custom indicators ................................................................................ 79

    5.5 Running reliable backtests in MetaTrader 4 ......................................................................... 81

    6 Final Words .................................................................................................................................... 84

  • 8/13/2019 GB Users Guide

    8/84

    Genetic Builder User's Guide

    8

    1 Introduction1.1 What is Genetic Builder?Genetic Builder is a program that automatically generates new unique trading strategies for forex,

    stocks or ETFs.

    Using Genetic Builder, you can easily find profitable trading strategies for virtually any market, any

    timeframe and any chart type. No programming or trading knowledge is required.

    The resulting strategies can be saved as a MetaTrader 4 Expert Advisor with complete source code.

    With Genetic Builder you can:

    Build an unlimited number of unique trading strategies Test them with maximum possible reliability on tick data Develop strategies for virtually any market or timeframe Save your strategies as a MetaTrader Expert Advisor with full source code! Eliminate the manual labor previously required when developing a trading strategy Find new trading strategiesthat are not only unique, but also non-obvious Reduce the time required to build a strategyfrom weeks and months to minutes!

    1.2 Is Genetic Builder Right for You?If you trade using automatic trading system (called also robots or Expert Advisors) or you plan to

    develop your own trading strategies then Genetic Builder can save you money and hundreds of

    hours of your time.

    Some traders prefer to purchase an existing trading robot, there is a multitude of offers especially for

    Forex.

    While this can be an effective way, by purchasing someone's forex robot you are usually purchasing a

    black box - you don't know how it works, what are the exact rules and you are at mercy of its creator

    with potential adaptations to changed market conditions.Genetic Builder allows you to create your own trading strategies, exportable to a plain Expert

    Advisor source code, so you have full control over your strategy.

    What If You Are a Manual Trader?

    You can still use for Genetic Builder to generate the trading ideas. You'll be surprised to find many

    profitable strategies based on relatively simple rules that you wouldn't think of.

    Every strategy that is created by Genetic Builder can be exported to readable pseudo code with full

    description of the trading rules and can be traded also manually.

  • 8/13/2019 GB Users Guide

    9/84

    Genetic Builder User's Guide

    9

    1.3 What to ExpectPlease keep in mind that Genetic Builder is a powerful tool, but it is not a magic boxthat will start

    making you money with a click on a button.

    It has to be used in the right way to get the results.

    Few things to realize:

    Generating new strategies in Genetic Builder is only about 50% of the work.

    The rest 50% of the work is evaluating the generated strategies to filter out the ones that are curve

    fitted or not robust enough.

    It is up to you to evaluate your new strategies properly and know their strengths, weaknesses and

    limitations before you put them to live trading.

    It can easily happen that from all the profitable strategies generated by Genetic Builder only 1 out of

    10passes the evaluationand we can consider using it for live trading.

    But - the number of strategies we can generate is almost endless, so even 5-10% from infinity is a

    pretty big number :-)

    There are few steps to evaluate the strategies quality and measure how good they will be in real live

    trading. Please read the Evaluating Generated Strategiessection for more information.

  • 8/13/2019 GB Users Guide

    10/84

    Genetic Builder User's Guide

    10

    1.4 Evaluating Generated StrategiesAs we said before, generating new strategy is only 50%of the work; the rest is evaluating it to ensure

    it is a real strategy with a real edge.

    Be prepared that there will be a lot of waste - only a small portion of the strategies will pass the

    evaluation.

    The main dangers with the new strategies generated by Genetic Builder are:

    Curve Fitting

    The most serious risk of strategies generated by Genetic Builder is curve fitting- there is a danger

    that a strategy with good backtest was simply curve fitted to the particular history data, and in reality

    it has no real trading edge.

    Fortunately, this is easy to detect, simply by testing the same strategy on a different symbol,

    timeframe or different date period.

    Differences in backtest results

    A small difference in backtest results between Genetic Builder and Metatrader is normal.

    If the difference is very big (and the equity curve looks totally different), it means the backtest in

    both GB and MT4 is only a guess and the results are NOT RELIABLE in both programs.

    The best thing we can do is avoid these strategies.

    Further evaluation of generated strategies should address these dangers and rule out strategies that

    are not good enough.

    The next steps after generating new fresh profitable strategy are:

    1. Look at the equity curveThe easiest test - the equity curve of a strategy should look almost linear, it should be

    continually growing without big drawdowns.

    Even if the strategies ended up with the same results, the right strategy goes up and down

    with big drawdowns and is not tradable.

    The strategies with bad equity curve should be ruled out immediately.

  • 8/13/2019 GB Users Guide

    11/84

    Genetic Builder User's Guide

    11

    2. Check the Risk Reward RatioYou should check how big the average winning trade as opposed to the losing trade is.

    The ideal is if the winning trade is bigger or at least the same as the losing one.

    Good strategy - if you make on average $100 on the winning trade and lose only $40 on the

    losing one, then you need to win only 1 out of 3 trades to make money.

    Bad strategy- if your strategy makes $5 on a winning trade but loses $100 on a losing trade,

    it is very bad strategy. You will usually have a big winning percentage, but one loss will take

    profits from many days or weeks.

    3. Test for robustness and curve fittingThe best is to test the strategy on a different part of data. You can develop your strategy on

    50-60% of available history data, and then test it on the rest of data. If the strategy is robust,it should behave the same also on an "unknown" period.

    Higher level of robustness is if the strategy works also on a different symbol or timeframe.

    For example, if you generated your strategy on GBPUSD, you can retest it on EURUSD. Or if

    you generated it using 1H timeframe, try running the test on 30 Minutes or 4H timeframe.

    The result of a retest doesntneed to be as good as the initial test, and many profitable

    strategies will not work on a different symbol. But if you'll find a strategy that works on

    multiple symbols you found a really robust strategy.

    Good strategy- will be profitable on both initial test and retest and the equity curves will

    look "normal" in both of them.

    Bad strategy- will have a good results and good equity curve on the initial test (first part of

    data), but when you retest it (second , the "unknown" part of data) it will be either not

    profitable, or the equity curve will be bad and random.

    4. Test for backtest reliabilityWhen the strategy passed the previous steps we can test it on MetaTrader. Simply export the

    strategy (in Results -> Source code) and save it as the MetaTrader EA. Then retest thestrategy in Metatrader again using the same settings as in Genetic Builder and check the

    results of the test.

    Good strategy- the results in both Genetic Builder and MetaTrader are the same, or almost

    the same, and the equity curve looks the same. This means the strategy is robust and the

    backtest was very accurate, so we can expect the strategy will behave the same also in the

    live trading.

    Bad strategy- the results in MetaTrader are totally different from Genetic Builder (for

    example strategy is losing on MT4 while it was profitable in GB). This means the strategycannot be reliably tested and we have to avoid it.

  • 8/13/2019 GB Users Guide

    12/84

    Genetic Builder User's Guide

    12

    5. Did your strategy pass all the above steps?Congratulations, you've probably found a gem, and very likely a strategy that nobody else

    knows about.

    Note

    If you have different result of tests between Genetic Builder and MetaTrader, it is

    possible that you are simply not testing it correctly.

    Please check the next chapter - Backtesting issues- for possible reasons of a differentresults.

  • 8/13/2019 GB Users Guide

    13/84

    Genetic Builder User's Guide

    13

    1.5 Backtesting issuesGenetic Builder has its own very fast backtester that can test the performance of a strategy on a

    historical data in a matter of seconds (depending on the length of the input price data file).

    The backtested uses its own testing algorithm, which produces reliable results, but the backtest

    results in some specific cases might be not 100% the same as running the same backtest in

    MetaTrader 4.

    This can have few reasons:

    1. Incorrect use of MetaTrader Strategy Testerit seems that backtesting in MetaTrader is simple, but we should use some techniques in

    order to run really reliable backtests in MetaTrader Strategy Tester. They are described at

    the end of this book in the chapter How to - Running reliable backtests in MetaTrader 4.

    2. Different data, timeframe or periodTo obtain comparable results you should use the same data, timeframe and period in both

    Genetic Builder and Metatrader.

    Note that every broker has slightly different data feed, so there will be always some

    difference if you test your strategy on the same symbol (for example EURUSD) but with data

    from different sources.

    Different spread or Min distance from order price

    Genetic Builder allows you to configure spread and min distance from order price. Make sure

    you use exactly the same values as you have in your Metatrader.

    If your Metatrader is connected live, its spreads can change with every tick, so it is impossible

    to get a fixed spread. Different spread can have very big influence on test results, especially

    on strategies that trade frequently.

    The strategy source code contains control for this, and if it finds a difference it will display

    the warnings visible in the Journaltab of the MetaTrader Strategy Tester.

    3. Bad Test precisionPlease check that you use Test precision: Tick simulation in Genetic Builder and Model: Every

    tick in Metatrader. This will produce the most accurate results.

  • 8/13/2019 GB Users Guide

    14/84

    Genetic Builder User's Guide

    14

    If you don't get the same results in MetaTrader as in Genetic Builder, make sure you checked all the

    steps above. They have to be handled so that we can have comparable backtests between Genetic

    Builder and MetaTrader.

    However, there's one more possible reason for the difference in results:

    4. Bad backtest reliability of a strategyThere is a certain type of strategies that will always have different backtest results in Genetic

    Builder and MetaTrader - those are strategies that often use consecutive orders (one order is

    closed for example at 18:30 and immediately a new order is opened).

    The main cause of these differences is a different tick simulation algorithm. Since both

    Genetic Builder and MetaTrader test the strategies on 1 minute data, the price changes

    within this 1 minute have to be simulated.

    Different tick simulation leads to trades that are missed or added in GB compared to MT4,

    which could have big effect on the test results.

    The main point to understand is that it is impossible to test this kind of strategy reliably.

    The test results in both GB and MT4 are only a guess and the results are NOT RELIABLE AT

    ALL in both programs.

    Don't get confused if MetaTrader gives you 90% modeling quality, it doesn't mean that its

    backtest is 90% reliable. In this case it is the missing 10% that can make a huge difference in

    results.

    If we'll look at it from a different angle - the different backtesting results between

    MetaTrader and Genetic Builder is actually a GOOD THING- it allows us to filter out

    strategies that are too sensitive to a price changes on a tick level, which means they are not

    robust enough and impossible to backtest reliably.

    Note

    Since version 2.0 and support for tick data we can use a little trick to achieve the same

    backtest results in GB as in MT4.

    Please read more in the section

    How To Importing tick data from MetaTrader

  • 8/13/2019 GB Users Guide

    15/84

    Genetic Builder User's Guide

    15

    1.6 RequirementsGenetic Builder is not an EA, it is a normal program (EXE file) for Microsoft Windows and it will run on

    all standard computers with Internet connection.Strategy generation and backtesting are very time

    consuming, so the faster computer you have, the faster you'll get the results.

    1.6.1 InstallationGenetic Builder comes with standard setup wizard, you just download and run the installation EXE

    file and follow the steps in the installation wizard.

    Important !!!

    Please DON'T install Genetic Builder to standard C:\Program Files directory !

    It might not work correctly because Windows security settings don't allow the

    program to write to its data files.

    Instead install it to any normal drive or directory on the disk,

    like C:\Genetic Builder

    or C:\Trading\GeneticBuilder

  • 8/13/2019 GB Users Guide

    16/84

    Genetic Builder User's Guide

    16

    1.7 New FeaturesThere is a number of new features in version 2 that bring the functionality of the program to a whole

    new level.

    The main improvements are:

    Greatly improved testing speed and support for multi-core processors

    the backtesting speed has been improved by nearly 50% and the new version now also supports

    multiple cores. Read more here:Using multiple cores

    Support for tick data

    perhaps the most important feature in the new version. It enables you to test your strategies in a

    biggest possible precision.

    Quality tick data can be obtained for free for example from Dukascopy here:http://www.dukascopy.com/swiss/english/marketwatch/historical/

    Genetic Builder now supports configurable input format, so you can import virtually any data into GB

    without making any conversion.

    100% compatibility of test results with MetaTrader4

    this is a nice positive side effect of tick data support. We can now export simulated tick data from

    MetaTrader and run our GB backtests on this MetaTrader tick data, achieving almost 100%

    comparability of the results. There will be only very small differences resulting from roundingnumbers and the way MT4 computes profit/loss.

    Support for Custom Indicators

    another important feature enabling you to use your favorite indicators in your strategies without the

    need for them to be build-in Genetic Builder.

    You can read more about custom indicators in these sections:

    Custom Indicators

    Importing custom indicator from MetaTrader to GB

    Manage Custom Indicators

    Custom Dismiss Options

    a small but important feature that allows us to specify the exact conditions for strategies to be

    dismissed. This enables us to effectively filter out the strategies that dont fulfill our performance

    criteria.

    Strategy Editora new feature that allows you to edit or create a new strategy. More here:Strategy Editor

    http://www.dukascopy.com/swiss/english/marketwatch/historical/http://www.dukascopy.com/swiss/english/marketwatch/historical/http://www.dukascopy.com/swiss/english/marketwatch/historical/
  • 8/13/2019 GB Users Guide

    17/84

    Genetic Builder User's Guide

    17

    Configurable RRR for SL/PT

    the Strategy Options settings was enhanced with the possibility to define the boundaries for desired

    RiskReward Ratio. More here:Stop Loss and Profit Target Options

    Candle Patterns

    new candle patterns building blocks, such as Doji, Hammer, Shooting Star, Engulfing, etc.

    Genetic Builder also comes with a custom indicator located in

    {GB directory}/custom_indicators/mt4/indicators/GenBuilder_Pattern_Recognition.mq4

    that displays these candle patterns on the chart. You only need to copy the indicator to your

    MetaTrader /expert/indicators directory and apply it on the chart.

    Number of smaller enhancements

    such as improved speed, improved ranking and elimination criteria, new building blocks, more

    exports, better source code generation and so on.

  • 8/13/2019 GB Users Guide

    18/84

    Genetic Builder User's Guide

    18

    2 How does it work?Genetic Builder is a program, it doesn't have the brain or experience of a trader, and it doesnt know

    how to create a profitable strategy.

    What it does is that it randomly combines available building blocks (indicators, prices, etc.) to create

    new trading rules. The resulting strategy is then tested on a history data to see if it is profitable.

    Random generation is the foundation of Genetic Builder. Strategies generated this way can be

    further improved (evolved) using Genetic evolution.

    2.1 Random generation of trading strategiesA trading strategy in the initial population is constructed using a combination of price patterns,

    technical indicators, order types, and other parts to form the entry and exit rules.

    Genetic Builder can use all standard technical indicators and oscillators (like CCI, RSI, Stochastic, etc.),

    time values (like time of day, day of week) and price patterns. These building blocks are then

    combined using logical and equality operators (and, or, >,

  • 8/13/2019 GB Users Guide

    19/84

    Genetic Builder User's Guide

    19

    strategy is profitable, but Genetic Builder can produce and test thousands of new strategies per hour,

    and there are many profitable ones in this amount.

    2.2 Genetic EvolutionGenetic Evolution takes the process of finding a suitable trading strategies even further.

    In this mode Genetic Builder first creates a number of random strategies, which are used as the initial

    population in the evolution.

    This initial generation of strategies is then "evolved" over successive generations using genetic

    programming technology.

    This process imitates the evolution - the algorithm chooses the fittest strategies (using selected

    performance criteria) in every generation, and the group of fittest candidates is then used to produce

    new generation of trading strategies.

    As in evolution, this should result in better and better candidates, in our case in strategies that are

    more profitable, more stable, or generally better in the selected performance criteria.

    http://127.0.0.1/sonar/GeneticBuilder/website/geneticbuilder.com/images/genetic_flow.png
  • 8/13/2019 GB Users Guide

    20/84

    Genetic Builder User's Guide

    20

    2.3 Supported building blocksGenetic Builder currently supports the following components to build entry and exit rules:

    Indicators

    Simple Moving Average

    Exponential Moving Average

    Weighted Moving Average

    Commodity Channel Index (CCI)

    Relative Strength Index (RSI)

    Stochastic

    MACD

    Bollinger Bands

    Qualitative Quantitative Estimation (QQE)

    Triple Exponential Moving Average

    Custom Indicators ***

    Average Directional Movement Index (ADX)

    Average True Range (ATR)

    Momentum

    Williams % Range

    True Range

    Price Difference

    Highest, Lowest

    Keltner Channel

    Parabolic SAR

    Ichimoku

    Price Values

    Open

    High

    Open Daily

    High Daily

    Heiken Ashi Open

    Heiken Ashi High

    Candle Patterns

    Doji

    Hammer

    Bullish Engulfing

    Low

    Close

    Low Daily

    Close Daily

    Heiken Ashi Low

    Heiken Ashi Close

    Shooting Star

    Dark Cloud Cover

    Piercing Line

    Bearish Engulfing

    OperatorsGreater

    Lower

    Crosses Above

    Crosses Below

    And

    Or

    Addition (+)

    Subtraction (-)

    Multiplication (*)

    Equals

    Not Equals

    Time Values

    Hour

    Minute

    Day of Week

  • 8/13/2019 GB Users Guide

    21/84

    Genetic Builder User's Guide

    21

    Order Types

    Enter at Market

    Enter at Limit

    Enter at Stop

    Exit Types

    Stop LossExit After X Bars

    Exit Rule (Price + Operators + Indicators, ...)

    Profit TargetMove Stop Loss to Break-even

    Trailing Stop

    We will be continually adding new technical indicators and other features to the Builder.

    If you have your favorite indicator you'd like to see in Genetic Builder, just let us know.

    2.4 Custom IndicatorsSince version 2.0 the Builder offers almost infinite flexibility of building blocks with custom indicators.

    In contrast with build-in indicators, Genetic Builder doesnt know how to compute custom indicators;

    they are defined by their data. This will enable you to use virtually any of your favorite indicators in

    Genetic Builder.

    There are no real limitsyou can use multi-timeframe or multi-symbol indicators, generally every

    indicator that works in MetaTrader can be

    The way it works is that you have to export the values of the indicator computed on a specific symbol

    and timeframe to a file, and then import this file as a custom indicator to the Builder.

    This way youll create new custom indicator (with values computed in another program, such asMT4) for this specific symbol and timeframe also in GB.

    Remember, every custom indicator is defined for a specific combination of symbol and timeframe

    (on which it was computed). To use the same indicator on another symbol or timeframe, you have to

    recomputed its data in MT4, export it and create a new custom indicator for this symbol/timeframe

    combination.

  • 8/13/2019 GB Users Guide

    22/84

    Genetic Builder User's Guide

    22

    2.5 Modes of operationThe program has two main modes (Genetic Evolutionand Random Generation) that allow you to

    generate new unique trading strategies. Each of these modes has its own pros and cons.

    The third complementary mode (Strategies Testing) can be used during the evaluation phase to test

    the already generated strategies on a different symbols, timeframes or time periods.

    2.5.1 Genetic EvolutionThe "full" mode. Genetic Builder first generates initial population of random candidates (using the

    Random Generation mode) and then uses genetic evolution process to evolve the population and

    produce better and better candidates with each generation.

    The process ends when predefined number of generations is reached or when there's no further

    improvement.

    Pros:

    in theory it should lead to strategies better than the initial random generation this means that the already good strategies in the first generation can be further improved search for profitable strategy in the trillions of possible combinations can be more effective

    with the power of evolution

    Cons:

    evolution is slow sometimes the evolution can lead to the dead end, so the generation should be watched the group of generated strategies is limited by population size

    2.5.2 Random GenerationIn this mode Genetic Builder continually generates and tests new random strategies, one after

    another, until it is stopped. The top candidates (based on predefined criteria) are stored into

    Databank so you can review them later.

    Pros:

    faster and simpler than genetic evolution it will run until it is stopped, so if you let it run for a few days it can generate and evaluate

    millions of strategies

    Cons:

    once the strategies are generated they are not further improved

  • 8/13/2019 GB Users Guide

    23/84

    Genetic Builder User's Guide

    23

    2.5.3 "Mixed" modeIt is possible to "mix" these two generation modes to get the best from both. For example, you can

    first use Random Generationto generate a number of good strategies, evaluate them and choose

    only the best.

    Then, in the next step, you can use these existing saved strategies as an initial population for Genetic

    Evolutionmode.

    This means that the Genetic Builder will not create new random initial generation, but it will use

    already existing strategies as the first generation. This first generation of already good strategies is

    then further evolved to produce potentially better strategies.

    2.5.4 Strategy TestingAn additional mode that allows to test already generated strategies on different data and

    timeframes.

    It allows you to test the strategies that are in Databank on a different symbol, timeframe, date

    period, or using a different spread or trade settings.

    Strategy Testing mode is necessary for evaluation of robustness of generated strategies.

  • 8/13/2019 GB Users Guide

    24/84

    Genetic Builder User's Guide

    24

    3 Quick start with the program3.1 Main conceptsWhen we first start the program we'll see the main screen as in the picture below.

    The program functionality is divided into tabs on the left side.

    These tabs are:

    Home- starting screen of the program, it contains the sample settings, news and helpful links Data - here you can configure which data to use for tests and manage history data Build - screen to start, pause and stop the building process Settings- configuration of building and strategy options Results- new generated strategies

    Databank

    Databank(in the Resultstab) is the most important concept you should understand when using

    Genetic Builder. Doesn't matter which mode you use, the best resulting strategies are always stored

    in the Databank.

  • 8/13/2019 GB Users Guide

    25/84

    Genetic Builder User's Guide

    25

    There you can sort the strategies by its properties, load and save them, and when you double click on

    a row, it will open the strategy test details in the results window above.

    You can configure how many top strategies (10, 100 or 500) will be stored in Databank, what

    comparison criterion to use which strategies to dismiss automatically (for example those with

    negative P/L).

    Working with files

    Strategies in Genetic Builder are saved in its own proprietary file format (with .str extension) that can

    be opened only by Genetic Builder. If you find potentially good strategies you should always save

    them so that you can work with them later.

    Using multiple cores

    Since version 2.0 Genetic Builder can now use all cores of your processor to run tasks in parallel,

    which greatly improves generation speed.

    You can define how many cores the program should use in the program options in menu Tools ->

    Options

    The program options dialog has a slider containing all available processor cores. By moving the slider

    you can increase or decrease number of threads / processor cores used by the program.

    Running strategies in MetaTrader

    MetaTrader cannot read the strategy .str files. If you want to test or run your new strategies in

    MetaTrader you have to export the strategy to MQL source code. Please check the section How

    to - Export strategy from Genetic Builder and test it in MetaTrader.

    Please note that exported (*.MQ4) files are not readable by Genetic Builder, so make sure you

    always save your strategy also as a normal strategy file (*.str).

  • 8/13/2019 GB Users Guide

    26/84

    Genetic Builder User's Guide

    26

    3.2 Flow of workThe general flow of work when generating new strategies can be described as follows:

    Step 1: Configure data for backtest

    You can use the history data that come with the program or optionally import your own data in

    Metatrader format. Then set up the tie period and timeframe you want to use.

    If you'll use genetic evolution mode you have to select the In Sample and Out of Sample periods.

    Step 2: Choose mode of operation

    Choose between Genetic Evolution or Random Generation mode to create new strategies, or

    Strategies Testing if you want to retest existing strategies.

    Step 3: Configure settings

    Go through all the settings and configure strategy type, indicators and order types to be used for

    trading rules. Optionally use time constraints to limit trading to a certain time range.

    Set up the strategy ranking rules and how the strategies will be stored into Databank.

    Step 4: Build

    Click on Build button to start building the strategies.

    Step 5: Evaluate the generated strategies

    Go through the generated strategies and evaluate them. Choose the best ones to consider in the

    next step.

    Step 6: Save the strategies and export them to MetaTrader code

    This is actually the last step of evaluation, we should export the strategies to MetaTrader EA to test

    them in MetaTrader. These that pass all the tests can be used for demo or live trading.

  • 8/13/2019 GB Users Guide

    27/84

    Genetic Builder User's Guide

    27

    3.3 Random Generation in step-by-step examplesThe goal: generate new unique trading strategies for forex.

    In this quick start you'll get a quick overview of all the main screens of the program and you'll see

    how easy it is to generate new trading strategies in Genetic Builder.

    3.3.1 Step 1: Obtaining history data for backtestGenetic Builder already comes with more than 4 years of real history data for major forex pairs

    (history data provided bywww.ForexHistoryDatabase.com ), so you can build your strategies right

    away.

    Or, optionally, you can export the history data from your MetaTrader 4 installation and import them

    to Genetic Builder.

    3.3.2 Step 2: Configuring the build processWhen we first start the program we'll see the main screen as in the picture below.

    The program uses tabs on the left to switch between the screens. The first screen is Home.

    It provides quick navigation and contains some sample settings.

    You can use one of the four sample settings to test various build configurations, or start from scratch

    as in this example.

    http://www.forexhistorydatabase.com/http://www.forexhistorydatabase.com/http://www.forexhistorydatabase.com/http://www.forexhistorydatabase.com/
  • 8/13/2019 GB Users Guide

    28/84

    Genetic Builder User's Guide

    28

    Choosing the data

    Switch to Datatab and choose GBPUSD_fhdb. This way we'll choose that the strategy backtests

    should be made on GBPUSD data on given period and timeframe. We can leave everything else at the

    default values.

  • 8/13/2019 GB Users Guide

    29/84

    Genetic Builder User's Guide

    29

    Choosing mode of operation

    On the Buildtab there is a possibility to choose the mode of operation. We can choose from three

    modes, in this example we'll choose Random Generationmode, which means the Builder will

    continually generate and test new random strategies, without using genetic evolution.

    You can read more about the operation modeshere.

    We'll not start build process yet, we have to review the settings before that.

    Reviewing the settings

    Switch to Settingstab now.

    There are three settings screens for the Random Generation mode, we'll go through each of them.More detailed description of all the settings can be found in the User's Guide, in this sample we can

    leave most of it at the default values.

    When we switch to Strategy Optionstab (on the bottom of the right Settings screen), we can

    configure the properties of strategies we want to generate.

    It is possible to generate only strategies that take only Long or only Short orders, but in this case we

    want strategies with both Long & Short orders.

  • 8/13/2019 GB Users Guide

    30/84

    Genetic Builder User's Guide

    30

    The next settings tab is Building Blocks. It is generally a list of all the elements - technical indicators,

    price and time values, operators, etc. that can be used in generated strategies. So here we are able

    to specify which of the building blocks we want to use.

  • 8/13/2019 GB Users Guide

    31/84

    Genetic Builder User's Guide

    31

    Strategies are generated randomly, using only the blocks that are checked, so you can choose your

    own combination of indicators and operators.

    We can keep all entry building blocks checked. For Order Types & Exit Blocks, we'll choose only Enter

    at Market, Stop Loss and Profit Target for simplicity.

    This means that Genetic Builder can use all available building blocks for generating the entry rules(for entering the trade), but it will generate only strategies that enter at market price and have exit

    target defined as fixed or ATR based number of pips.

    The last tab in the settings is Strategy Ranking Options. Here we can configure the strategy ranking

    criteria - every strategy is tested on historical data and the performance (using the chosen criteria) is

    then computed into the strategy rank number, also called Fitness. The program uses this strategy

    fitness to compare one strategy to another and to determine best strategies.

    To make it simple, we'll configure it to use only Net Profit and Profit Factor criteria for Fitness

    computation.

    We can also specify which strategies should be saved in the Databank for later review. In Random

    Generation, the program generates and tests one random strategy after another until it is stopped,

    so it can effectively create tens of thousands of strategies in a matter of minutes.

    It is not possible to save or remember every generated strategy, and also, not every strategy is

    profitable. The Databank is used to keep the given number (100 in our example) of best strategies.

    We are done with our settings with these four screens. The next step is to start the building process

    and just wait for the results.

  • 8/13/2019 GB Users Guide

    32/84

    Genetic Builder User's Guide

    32

    3.3.3 Step 3: Starting the generationWe'll start the random generation by simply clicking on the Start button in the Build screen.

    The program begins generating strategies and shows its progress in the log in the Build screen.

    You can see it usually takes a less than a second (depending on a precision mode) to generate and

    backtest the new strategy on the historical data.

    http://127.0.0.1/sonar/GeneticBuilder/website/geneticbuilder.com/images/n_quick_start.pnghttp://127.0.0.1/sonar/GeneticBuilder/website/geneticbuilder.com/images/n_quick_start.png
  • 8/13/2019 GB Users Guide

    33/84

    Genetic Builder User's Guide

    33

    The generated strategies are continually compared and sorted and the top 100 of them are stored

    into the Databankin the Resultstab.

    3.3.4 Step 4: Stopping the generation and reviewing the resultsGenetic Builder will continue to work and generate new strategies until you stop it, which you can do

    by hitting the Stop button in the Build screen.

    Depending on how powerful your computer is, it can take 10-30 minutes to generate and test few

    hundreds of different strategies.

    By now you should have full Databank (100 best strategies were stored there), so you can sort the

    strategies in the databank for example by Fitness (our rank criterion computed using Net profit and

    Profit factor).

    If you want to see the details of the strategy, simply double clickon its row.

  • 8/13/2019 GB Users Guide

    34/84

    Genetic Builder User's Guide

    34

    This will open the strategy results in the Results detailswindow (above the Databank).

    The first screen in the results is Overview- it gives you all the summary results of this strategy

    backtest on one screen.

    The next screen is List of trades- pretty self explanatory - it shows the complete list of trades of this

    strategy in the backtest.

    Equity chartdisplays the development of equity during the backtested period. We can see that thegenerated strategy is quite stable, it grows almost linearly without very big oscillations.

  • 8/13/2019 GB Users Guide

    35/84

    Genetic Builder User's Guide

    35

    The last tab for this strategy is Source code. Here you can get the complete MetaTrader Expert

    Advisor source code for this strategy.

    You can just save the source to a MQ4 file, copy it to MetaTrader 4 and run an independent backtest

    or (after more testing) start this new strategy as an automatic robot on your demo or live account.

    It really can't be more simple than that.

    3.3.5 Summing it upIn a few simple steps and in a few minutes we quickly generated tens of new profitable trading

    strategies.

    The features of the program are more richer than this basic example, there are almost endless

    possibilities of how you can play with the configuration to generate strategies with differentproperties.

  • 8/13/2019 GB Users Guide

    36/84

    Genetic Builder User's Guide

    36

    4 Detailed Description4.1 Data tab4.1.1 Data for backtestGenetic Builder tests all the generated strategies on a given history data and this screen allows you

    to choose the symbol and timeframe to be used for backtests.

    There is an option to choose also the testing period (Date From, Date To).

    Out of Sample Periodallows you to split the history data to two parts:

    In Sample- it is used during genetic evolution to compute the rank of the strategies, so thatthe program is able to compare them

    Out of Sample- this part of the data is used to verify if strategy really works as expected alsoon data that it was not evolved

    4.1.2 Manage History DataThis screen is where you can manage (create, import, modify) the history data that are used for

    backtesting.

    Note

    Setting the Out of Sample period makes sense for Genetic Evolution mode, because only in this

    mode the fitness results computed in the In Sample data are used to rank the strategies to find

    the "fittest" strategies.

    The other modes (Random Generation, Strategy Testing) don't use evolution, so you don't need

    to split the data to two periods. F or these two modes you can move the Out of Sample splitter

    to the far right, leaving Out f Sample period empty.

  • 8/13/2019 GB Users Guide

    37/84

    Genetic Builder User's Guide

    37

    Genetic Builder already comes with 4 years history data for the major pairs, but if you have your own

    history data in Metatrader, you can easily import them.

    Check the section How to import data from Metatraderfor more description.

    4.1.3 Manage Custom IndicatorsHere you can manage custom indicators that are used in strategies generation and in backtesting.

    Custom indicators are a new feature in GB version 2.0. To say it simply, they allow GB to use

    indicators that are not build-in the program.

    This allows you to use virtually any of your favorite indicators inside Genetic Builder as standard

    building blocks, including complicated ones that use multi-timeframe or multi-symbol analysis.

  • 8/13/2019 GB Users Guide

    38/84

    Genetic Builder User's Guide

    38

    4.2 Build tabBuild tab is a place where you can choose the mode of the program and where you can start, pause

    or stop the generation process.

    Before starting the build you should have the data and settings configured. The results (generated

    top strategies) will be continually stored in the Databankin the Results tab.

  • 8/13/2019 GB Users Guide

    39/84

    Genetic Builder User's Guide

    39

    4.3 Settings tabThe available settings are dependent on the chosen mode of operation, for Genetic Evolution there

    are four setting screens, for Random Generation only three, and for Strategies Testing there is no

    setting required other than specifying data for backtest.

    4.3.1 Build Goals4.3.1.1 Market SidesYou can choose to generate strategies that trade only to one direction (Long or Short) or to both

    directions (which is standard).

    You can also select that you want the entry or exit rules to be symmetrical. If they are symmetrical,

    then the rules for both directions are the same, only reversed.

    An example of symmetrical rule s:

    Go Long if CCI > 0

    Go Short if CCI < 0

    As an alternative, you can choose to use non-symmetrical rules, in this case the rules for Long and

    Short sides will be generated independently.

    An example of non-symmetrical rules:

    Go Long if CCI > 0

    Go Short if RSI < 0 and Momentum < 100

    This settings can be used for both entry and exit rules, for example you can have symmetrical entry

    rules, but non-symmetrical exit rules, so the strategy will effectively use (for example) different stop

    loss and profit target for Long and Short orders.

    4.3.1.2 Choose Build GoalThis is a new advanced feature available from version 1.1.

    Build a complete strategy

    is a default mode - as expected it generates new random strategies using either random generation

    or genetic evolution.

    Optimize strategy parts

    is a new mode that allows you to take existing strategy generated by Genetic Builder and re-generate

    only a part of it.

    This way you can for example look for better exit rules, or generate a new rule for long entry while

    keeping the short entry rule from original strategy.When you run random generation or Genetic Evolution with this goal, it will produce new strategies

  • 8/13/2019 GB Users Guide

    40/84

    Genetic Builder User's Guide

    40

    as usual, but instead of generating totally random strategies it will generate strategies based on the

    source strategy (see below) with only selected parts generated randomly.

    4.3.1.3

    Choose parts to optimize

    This is a setting that is valid only in parts optimization mode. It allows you to choose which parts of

    the strategy should be re-generated and which will be fixed.

    Check an example below. In this configuration we would like to improve the bonus EURUSD strategy

    number 0.22952.

    We are satisfied with trades into short direction, so we'll choose to generate new rules for long

    direction. To do this, we had to check LONG Entry Rules and LONG Exit Rules. The text next to the

    checkbox has changed to Generated Randomly.

    This means that this part of the strategy will be generated randomly using available building blocks.

    When we'll start Random Generation or Genetic Evolution, it will not create new strategies from the

    scratch, but it will generate new strategies with Short rules taken from our EURUSD strategy 0.22952

    and randomly generated new Long rules (entry and exit).

    As usual, new strategies generated this way will be stored into Databank.

  • 8/13/2019 GB Users Guide

    41/84

    Genetic Builder User's Guide

    41

    4.3.2 Strategy Options ScreenHere you can define the desired properties of the generated strategies.

    4.3.2.1 Trading LogicTrading logic defines the behavior of the strategy during the day.

    Exit at end of day/end of range

    if selected, the strategy will close all position at the end of the day or end of the trading range (if

    defined). This way you'll have no position open overnight.

    Limit max trades per day to

    you can limit maximum trades the strategy takes per day to a given number

    Limit maximum total trades to

    you can limit maximum total trades to a given number. It is usually good to use this limit and set it to

    some big number (1000-5000, depending on how many trades you expect normally).

    It can help GB to filter out strategies with incorrect rules that generate many very small trades, or

    scalping strategies that cannot be accurately tested using GB.

    Limit trading to hours

    this limits the hours the strategy is checking for entry signal to a given time range.

    If used in combination with Exit at end of day/end of rangethen all open positions are closed at the

    end of the range.

    If you don't check the Exit at end of day/end of rangethen the strategy will not open new trades

    outside the trading range, but the already opened positions will be not closed.

    4.3.2.2 Stop Loss and Profit Target OptionsThis panel allows you to configure various parameters of Stop Loss and Profit Target. You can specify

    that settings allow you to specify of the Stop Loss and Profit Target are mandatory in the strategy,

    and what is the minimum and maximum of the SL/PT values in pips.

    Having defined SL/PT in the strategy is the simplest and many times the most effective approach.

    If you unselect the mandatory SL/PT then the randomly generated strategy can (but doesn't have to)

    have fixed SL/PT. It is advisable to use different exit rule, for example exit after X bars or exit rule if

    you uncheck this setting, otherwise the strategy will have no way to exit the trade.

    You can also choose if SL/PT should be generated as a fixed value in pips, or using ATR.

  • 8/13/2019 GB Users Guide

    42/84

    Genetic Builder User's Guide

    42

    Then you can limit the ration between Stop Loss and Profit Target to a certain range. For example ifthe ratio is 1:3 then Profit Target will be 3x bigger than Stop Loss.

    4.3.2.3 Lookback PeriodsHere you can set up the periods and coefficients used by the GB when generating the trading rules.

    Maximum Period for Indicators

    sets the maximum period that will be used for indicators. Usually we don't use periods bigger than

    100-300 in the trading system (depending on the type of trading strategy), so it is advisable to set the

    desired maximum period value.

    Maximum Period for Price Patterns

    this is the maximum lookback period for price patterns (Open, High, Low, Close prices). It doesn't

    really make sense to set it to more than 10-20, because the older price usually has no relation with

    the current market movement.

    Minimum and Maximum ATR Multiple

    these are coefficients that are used in adaptive Stop Loss or Profit Target, if it is based on Average

    True Range value.

    For example, setting Minimum to 0.5 and Maximum to 5 tells GB that it can use minimum 0.5 * ATR

    as the SL or PT value and maximum 5 * ATR as the SL or PT value.

  • 8/13/2019 GB Users Guide

    43/84

    Genetic Builder User's Guide

    43

    4.3.3 Building Blocks ScreenBuilding blocks are the core components that are put together to create rules for every trading

    strategy.

    4.3.3.1 Entry Rules Building BlocksEntry building blocks can be divided into four main parts:

    price data - Open, High, Low, Close technical indicators -RSI, CCI, Momentum, etc. operators that are used for comparison and to combine the rules - , and, or, etc. time constants - Hour, Minute of day, Day of week simple predefined rules - CCI > 0, Stochastic < 50 etc.

    You have to check the components that you want to use in the strategy, so you can choose your

    favorite indicators, or choose for example only price data + operators if you want to generate

    strategies based only on price.

    NOTENon-standard Indicators !

    Some of the indicators supported by Genetic Builder are not standard indicators of MetaTrader.

    To be able to test the generated EAs in MetaTrader you have to add these indicators to your

    MetaTrader4 installation.

    It is simple, just copy all the *.mq4 files from the

    {Genetic Builder installation folder}/custom_indicators/mt4

    to your MetaTrader installation to path

    {Your Metatrader installation directory}/experts/indicators

    If you use more than one MetaTrader installations, you have to repeat this step for every MT4

    installation where you want to run EAs from Genetic Builder.

    Good practice

    According to our experience, you can sometimes get better results if you don't check all the

    available components, but narrow your choice to a smaller group of indicators or price values.

  • 8/13/2019 GB Users Guide

    44/84

    Genetic Builder User's Guide

    44

    4.3.3.2 Order TypesEnter at Market

    the simplest order type, opens the trade at the current market price (Long order at Ask price, Short

    order at Bid price).

    Enter at Stop/Limit

    sets up stop or limit order, so that the trade is opened only if the price reaches the given level.

    The decision if to use stop or limit type of order is made based on the desired price level, and current

    market price.

    Going Long:

    if price level is above current market price, use stop order, otherwise use limit order

    Going Short:if price level is below current market price, use stop order, otherwise use limit order

    Order types explained

    Stop Order

    A stop order is an order to buy or sell once the price reaches a specified price level, known as

    the stop price. When the stop price is reached, a stop order becomes a market order. A buy

    stop order is entered at a stop price above the current market price. A sell stop order is

    entered at a stop price below the current market price.

    Limit Order

    A limit order is an order to buy or sell at a specific price or better. A buy limit order can only

    be executed at the limit price or lower, and a sell limit order can only be executed at the limit

    price or higher.

    A stop or limit order is not guaranteed to execute

    This kind of order can only be filled if the market price reaches the stop or limit price. While

    they do not guarantee execution, they help ensure that an investor does not pay more than a

    pre-determined price.

    If the order is not executed within preset time, it will expire.

  • 8/13/2019 GB Users Guide

    45/84

    Genetic Builder User's Guide

    45

    4.3.3.3 Exit Building BlocksExit building blocks are used to determine when (at which conditions) the open trades should be

    closed.

    Every strategy can use a combination of all the allowed exit types, so it can use for example fixed

    Stop Loss and Profit Target plus Exit After X Bars as well as active Exit rule.

    Stop Loss (SL)

    stop loss is a special type of exit order that is normally used to protect us from unlimited loss. Let's

    say you are in the long position, you can place the stop loss order that will close your position if the

    price moves for example 100 pips against you.

    This way, you are effectively protecting yourself to lose maximum these 100 pips, and not more.

    We should never trade without stop order, otherwise our losses have no limit!

    Profit Target (PT)

    is the opposite of the Stop Loss, it can be used to take the profit once the price moves in your favor.

    As in the example above, you can set up a profit target to close the position once it makes for

    example 100 pips.

    Exit After X Bars

    this is very simple exit condition. If used, the strategy will close the trade after given number of bars

    (time periods on a given timeframe).

    This is many times a simple, but effective way to close the trade when the market moves sideways

    or when we want to lock in the profit.

    Note on Stop Loss / Profit Target

    Both Stop Loss and Profit Target can have either fixed value in pips (like 30, 50 or 100 pips), or

    they can be based on ATR (Average True Range), for example 2*ATR. This means that the

    actual value of the SL/PT will be 2 times the value of average true range at the time the trade

    was opened.

    ATR based SL/PT have the advantage that they "adapt" to changed market conditions and

    changes of volatility. Some strategies (but not all of them) can be more profitable when they

    use ATR based SL/PT instead of fixed one.

    To enable/disable ATR for SL/PT, you can enable/disable the Average True Range indicator in

    the Entry Building Blocks.

  • 8/13/2019 GB Users Guide

    46/84

    Genetic Builder User's Guide

    46

    Move Stop Loss to Break-Even

    another simple but quite powerful condition. It tells the strategy to move protective Stop Loss to the

    entry price (break even) when the given profit is reached. This will not close the trade, so the

    strategy will be still in position, but there is zero risk after this move.

    Because SL is at the entry price we'll not lose anything even if the trade reverses and goes against us.

    Exit Rule (Price + Operators + Indicators, ...)

    it is a special type of exit where strategy has not only rules for entering the trade (Entry rules) but

    also rules for exiting it (Exit rules). Exit rules look as same as entry rules - it is a combination of all the

    selected building blocks( indicators, operators, price values).

    Example of entry and exit rule pair:

    Entry Rule - if CCI > 0 Enter at Market

    Exit Rule - if RSI crosses above 100 and we are in long position then Close Trade

  • 8/13/2019 GB Users Guide

    47/84

    Genetic Builder User's Guide

    47

    4.3.4 Genetic Options ScreenThese are the options that control genetic evolution from the creation of the initial population, to

    coefficients used for mutation and crossover.

    4.3.4.1 Initial Population GenerationThere are two options for initial generation:

    Generate random population

    with this option Genetic Builder randomly generates new fresh initial population of trading strategies

    using the selected entry and exit building blocks. This is the default setting.

    Use systems in Databank as initial population

    if you already have some generated strategies, you can select this option to use them as the initial

    population. In this mode the existing strategies (loaded into Databank) are used as the first

    generation and they are evolved using the genetic evolution.

    This has the advantage that you have more control over the initial population, because you can pick

    only the strategies you want.

    This mode can be used also if you used Random Generation previously to generate the random

    strategies - by applying evolution to the result strategies we can improve their profitability.

    Decimation coefficient

    if you generate the strategies randomly, the "quality" or the strategies in the initial population may

    be skewed so that very large percentage of the population has in fact very poor quality (in terms of

    profitability, stability, etc.)

    Decimation Coefficient allows us to deal with this problem by generating more strategies than

    required and selecting only the top ones to the initial population and decimating (deleting) the rest.

    Let's say the population size is set to 50 strategies.

    If decimation coefficient is 1 then there's no decimation, and only 50 strategies aregenerated for the initial population.

    If you set the decimation coefficient to 2, then 2 * 50 = 100 strategies are generated, andfrom them the top 50 is chosen for the initial population.

    If you set the decimation coefficient to 3, then 3 * 50 = 150 strategies are generated, andfrom them the top 50 is chosen for the initial population and so on..

    Of course, decimation comes at the price. Generating 3 times more strategies is also 3 times more

    time consuming.

  • 8/13/2019 GB Users Guide

    48/84

    Genetic Builder User's Guide

    48

    4.3.4.2 Initial Population ConditionsThese conditions give us more control over the quality of the initial population.

    We can choose to not use strategies that:

    have negative P/L - which means they are losing made no trades in the backtest- which means that most probably the entry rules are not

    good

    contain warnings- warning is a possible flaw in the strategy design recognized by GeneticBuilder

    As with decimation, using this additional filtering has its price - when you'll start the build process

    you'll see that many (sometimes majority) of the strategies don't satisfy these conditions, so the

    Genetic Builder has to generate a large number of strategies (which takes time) in order to find these

    that fulfill all the quality conditions.

    4.3.4.3 Main ParametersThe main parameters for genetic evolution control how many strategies we want to generate, how

    many generations of evolution will be evolved, etc.

    Population size

    simply how many strategies we want to generate, it is also the number of strategies we want in the

    initial population.

    Elitism

    in genetic evolution, the strategies with better fitness have better chance to reproduce into the next

    generations than the strategies with lower fitness, and this chance is proportional to the fitness.

    However, there's no guarantee that the best strategies survive to the next evolution step, they can

    be ruled out by the random selection algorithm.

    Elitismallows us to specify a number of top strategies that will be automatically copied to the next

    generation on every step, so there's a guarantee that they will be never lost.

    As everything, this has also the weak side. If you set elitism too high, you are risking that just one or

    very few top strategies will force out the rest of the strategies and in the few steps you'll have

    population consisting only of one strategy and its slight variants. This can be a dead end, because the

    evolution cannot work without diversity.

    If you want to use evolution, you can experiment with the value, but it is recommended to not set it

    higher than 5-10 % of the population size.

  • 8/13/2019 GB Users Guide

    49/84

    Genetic Builder User's Guide

    49

    Max # of Generations

    how many generations of evolution should be processed. In Genetic Evolution mode the program will

    stop at the given number of generations.

    Max Tree Depth

    maximum depth of a tree when generating entry or exit rule. It says how complicated could be the

    entry condition. It usually makes no sense to set the depth higher than 5-7.

    Sometimes it could be interesting to experiment with depth as low as 1-2, which generates very

    simple entry conditions.

    4.3.4.4 Genetic OptionsGenetic options are parameters of the genetic evolution algorithms.

    Selection Type

    it allows you to choose the selection strategy that is used to pick the best strategies from the

    population. There are several types of selection, each with its strengths and weaknesses.

    Roulette Wheel SelectionImplements selection of n candidates from a population by selecting n candidates at random

    where the probability of each candidate getting selected is proportional to its fitness score.

    This is analogous to each candidate being assigned an area on a roulette wheel

    proportionate to its fitness and the wheel being spun i times. Candidates may be selectedmore than once.

    In some instances, particularly with small population sizes, the randomness of selection may

    result in excessively high occurrences of particular candidates. If this is a problem, Stochastic

    Universal Sampling provides an alternative fitness-proportionate strategy for selection.

    Sigma ScalingAn alternative to straightforward fitness-proportionate selection such as that offered by

    Roulette Wheel Selection and Stochastic Universal Sampling. Uses the mean population

    fitness and fitness standard deviation to adjust individual fitness scores. Early on in an

    evolutionary algorithm this helps to avoid premature convergence caused by the dominance

    of one or two relatively fit candidates in a population of mostly unfit individuals. It also helps

    to amplify minor fitness differences in a more mature population where the rate of

    improvement has slowed.

    Stochastic Universal SamplingAn alternative to Roulette Wheel Selection as a fitness-proportionate selection strategy.

    Ensures that the frequency of selection for each candidate is consistent with its expected

    frequency of selection.

  • 8/13/2019 GB Users Guide

    50/84

    Genetic Builder User's Guide

    50

    Truncation SelectionImplements selection of n candidates from a population by simply selecting the n candidates

    with the highest fitness scores (the rest are discarded). A candidate is never selected more

    than once.

    Crossover Probability

    percentage probability that selected candidates will be mated and generate children. Crossoverprobability should be high (over 90%) because mating between different candidates is fundamental

    in the evolution.

    Crossover Points

    number of points that will be exchanged during the mating.

    Mutation Probabilitypercentage probability that any of the strategies mutates. Mutation is important, because it can

    create new conditions that were not a part of the original population. The mutation percentage

    should be small - 5-10% maximum. If we set mutation too high, it will affect the evolution in a bad

    way and can go against strategy improvement.

    Note on Selection Type

    Selection type is an advanced setting for users who want to experiment and are interested in

    genetics. For most of the users Roulette Wheel Selection or Stochastic Universal Sampling is a

    ood choice.

  • 8/13/2019 GB Users Guide

    51/84

    Genetic Builder User's Guide

    51

    4.3.5 Strategy Ranking Options ScreenWhen the strategies are generated, every new strategy is backtested on a history data and the

    results of the backtest are then used to compute the Fitness(rank) of the strategy.

    Fitness is number from 0 to 1 and it should reflect the "quality" of the strategy according to the given

    criteria.

    In the Strategy Ranking Optionsscreen you can configure how this Fitnessvalue is computed

    (Computation criteria). You can also configure how many strategies to store into Databank, capital

    size for percentage drawdown calculation and you can define custom conditions to dismiss (filter

    out) bad strategies.

    4.3.5.1 Databank OptionsThe best strategies found are continually stored into the Databank.

    It is not possible to store every strategy (remember that Genetic Builder can create thousands of new

    strategies every hour) so we have to specify how many strategies should be stored in the Databank,

    how they should be sorted to find out the best ones and which strategies should be thrown away.

    You can use the options here to throw away strategies with bad properties.

    Throw away strategies with negative IS/OOS P/L

    checking these two options will throw away strategies that have negative results in In Sample or Out

  • 8/13/2019 GB Users Guide

    52/84

    Genetic Builder User's Guide

    52

    of Sample backtest. This makes sense, because we want profitable strategies, not the ones that

    create loss.

    Throw away strategies where # of trades equals max allowed trades

    if the strategy reached maximum allowed number of trades, it is usually a sign that something is

    wrong. It could be an always-in-position strategy with extremely small SL or PT. It is best to avoid thiskind of strategies.

    Throw away strategies with zero IS/OOS trades

    these two options will throw away strategies with zero trades in In Sample or Out of Sample periods.

    It can also make sense, if the strategy doesn't produce any trades, it is probably not a good one.

    Throw away strategies with warnings

    Some of the strategies can contain possible flaws in their rules and this can be recognized by Genetic

    Builder. Such strategy then contains a warning message. With this setting you can decide to throw

    away strategies with warnings.

    Throw away strategies with zero symmetry

    Symmetry is a ratio how similar are the results between the Long and Short direction. Normally we

    would like the strategy to be as symmetrical as possible, meaning that it would have very similar

    profit both to Long and Short side. If symmetry is zero, it means that one of the sides ended up with

    no trades or negative profit. You can choose to throw away this kind of strategy.

    4.3.5.2 Strategy Fitness Computation Criteriathis table is used to choose the criteria you want to use to compute the total Fitness of the strategy.

    Only the checked criteria will be used, and you can choose one or multiple criteria, each with a

    different weight.

    Note that if you choose to combine too many criteria, they might "fight" against each other without

    achieving what you expected.

    Profit Factor

    criterion to maximize Profit Factor of a strategy.

    Net Profit

    criterion to maximize Net Profit. Net Profit is a total profit/loss the strategy produced.

    Drawdown, % Drawdown

    criterion to minimize Drawdown or Percentage Drawdown of a strategy. Drawdown is the measure

    of the decline from a historical peak in running cumulative profit of the strategy.

    Number of trades

    simply a number of trades of this strategy in the backtest. You can use this criterion to approximate

  • 8/13/2019 GB Users Guide

    53/84

    Genetic Builder User's Guide

    53

    some preset value you would like to achieve (for example total 100 trades ). The value of this

    criterion will be bigger for strategies closer to the desired number of trades.

    Stability

    a special value in range from 0 (worst) to 1 (best) that measures how stabile is growth of the equity

    chart.

    You can see three sample strategies on the picture above. All of them finished with the same profit,but Strategy 1 was growing almost linearly (very stabile), Strategy 2 was growing with occasional big

    drawdowns (less stabile) and Strategy 3 was moving up and down (very little stability of growth).

    Stability is a value that is quite good in representing a "quality" of the trading strategy and it can be

    used as the only one or the main criterion to compute the total strategy Fitness.

    Symmetry

    criterion to maximize strategy symmetry. Symmetry value is in %, and it is measuring how much is

    the Profit/Loss for Long direction similar to Short direction.

    For example, if strategy makes $600 on Long trades, and $400 on Short trades, symmetry in this case

    is 66%. ($400 is 66% from $600).

    If the strategy makes the same profit on both directions, the symmetry will be 100%. If one of the

    directions produces loss or 0 profit, the symmetry will be 0%.

    Win/Loss Ratio

    criterion to maximize the ratio of winning trades vs. losing ones

    Return/DD Ratio

    criterion to maximize the ratio of Net Profit vs. Drawdown

    Average Win, Average Loss

    criterion to maximize average win or minimize average loss per trade

    Average Bars in Trade

    criterion to minimize the average number of bars the trade is open

  • 8/13/2019 GB Users Guide

    54/84

    Genetic Builder User's Guide

    54

    Average Bars Win, Average Bars Loss

    criterion to minimize the average number of bars for the winning/losing trade

    4.3.5.3 Fitness Computation OptionsSometimes one strategy can have its Fitness value much bigger than Fitness values of the rest of the

    strategies in the population.

    This strategy would get an unfairly high abundance in the population - because strategy with better

    fitness has bigger probability to get to the next generation, and the its chance is proportional to the

    fitness.

    With too big difference in fitness values, also the chance of selecting this one particular strategy is

    too high. In extreme case this could lead to a population consisting of on only clones of one strategy.

    Normalization can protect us from this, it acts as a "brake" for the evolution pressure. It can

    recompute the fitness values in the population with given coefficient and reduce the range between

    best and worst fitness. With smaller difference between best and worst candidates, no candidate

    would get too high abundance in the new generation.

    The higher Normalization coefficient is, the smaller is the evolution pressure and the strategies will

    be selected to the next generation less aggressively.

  • 8/13/2019 GB Users Guide

    55/84

    Genetic Builder User's Guide

    55

    4.4 Results tabResults tab is the place where you can see and review the generated strategies.

    The screen is divided into two separate areas. On the bottom there is a Databank, above is the Result

    Details window.

  • 8/13/2019 GB Users Guide

    56/84

    Genetic Builder User's Guide

    56

    4.4.1 DatabankDatabankis a storage place where the generated strategies are stored in all the program modes.

    4.4.1.1 Databank tab

    Each row in the table represents one strategy, the results of the strategy backtest - number of trades,

    total profit/loss, Fitness score, etc. are visible in the table columns. Results are divided into In Sample

    and Out of Sample parts.

    For mem