Back Home Up Next




US Markets Daily


Forthcoming Releases:

Fuzzy Logic:

Neural Net:
Release of NXL3

Yahoo Charts

The Genetic Pattern Finder
in 3 easy steps !

The G.P.F. 's learning curve may be a little long, but should hopefully not be too steep if you read this page.  The objective of this page is to show you that getting your first G.P.F. optimization going could be as simple as 1,2,3.


1. Selecting a fitness function.

2. Setting up a data source

3. Launching G.P.F. and analyzing results


Volatility increases, the market topology changes, and starts responding differently to new information.   All of a sudden, your favourite adaptive moving average is too lagged (well, it is always too lagged...), your overbought stochastic indicator is dead wrong,  and all traders have to live with a new environment, and change can sometimes be unsettling. All traders know that there are periods of time where markets are trending, or choppy or cyclical.  Making money in trending and cyclical markets is relatively easy. However, choppy, chaotic markets, and more importantly switching markets from one topology to the other can be unnerving, as they often force the trader to review their trading strategy.

While there have been endless attempts to build the ideal crystal ball, and consequently the "Holy Grail" trading strategy, most tools available to the trader are often simple combinations of trending and/or range-bound linear indicators. Experience has however shown, that those linear indicators always work until... they stop working. There are millions of reasons that cannot be listed exhaustively: limited search space, statistical flaws, and most often inadequacies to the actual trader's risk profile.

To our knowledge, the only way to minimize flaws is to use simple indicators that work in all type if markets, like break-outs, and raw graphical patterns. Alternatively, non linear indicators and strategies based on artificial intelligence and/or wavelet analysis can significantly alleviate such problems.

The G.P.F. is one step ahead in facilitating the trader's job in recognizing winning patterns. Genetic algorithms, and particularly the GeneHunter software from Ward Systems here provide a fantastic framework for the development of such systems.

1. Selecting a fitness function.

Fitness is a measure of how good an optimal solution is in solving a given problem. It can also be seen as a optimization objective. There is a list of 8 objectives to choose from. The fitness functions represent variations of one common problem all stock market traders have: detecting consistent patterns. The first 4 listed objectives are "long" signal objectives, the last 4 are "short" signal objectives. These 2 types of optimizations should be conducted in order to build your trading strategy.

The G.P.F. allows for 2-component and 3-component patterns over n bars (n=5 bars by default). Bars can be hours, days, weeks, or months according to your data format. These patterns differ from classical Japanese Candlesticks as the purpose is not to detect the actual "shape" of a bar, but rather comparing levels, the same way traders look for break-outs.

The G.P.F. also allows for common trading parameters, like slippage, commissions, and stop losses, as these parameters will significantly influence the optimization. This is maybe where our development strategy departs significantly from other developers who design or crunch numbers, signals and indicators and then feed them through a trading strategy.  We believe it is essential to give trading guidelines at the earliest design stage.

However, the G.P.F.'s purpose is certainly not to include advanced features ordinarily part of trading programs like Omega TradeStation™ or SuperCharts™ (reg. trademarks of Omega Research). For instance it has therefore been decided not to include point conversion to whichever currency or currency multiplier.

Patterns are not always significant. Low volumes indeed turn stock market information into "noise". An option is therefore given to ignore low volume bars.  Several other filters are also available, and again play a major role in differentiating patterns.  The genetic process does take all these refinements into consideration while searching for good patterns, whereas most other approaches would filter out signals after the optimization process.

2. Setting up a data source

The data source can be any file readable by MS Excel 97/2000/XP. Choice is given to select any worksheet in any open workbook.

Data should be made available to the G.P.F. prior to clicking the little Piggy on the menu bar. The form can eventually be hidden or closed. Closing the G.P.F. form resets all settings and variables. On the other hand, hiding the form allows you to call it later back to its previous state.

Several data formats are built-in to facilitate the data import into the G.P.F.  Any other information on the worksheet is irrelevant to the G.P.F.

The G.P.F. can use Open, High, Low, Close and Volume, as long as they are formatted in separate columns, and rows from top to bottom in chronological order i.e. older data first. Default location is provided when selecting a format. The G.P.F. needs at least High, Low and Close to perform its computations.  If you copy and paste DialData quotes, you may get rows with just a date (holidays). These rows will automatically be deleted, to make adjacent rows 'connect' in pattern formation.

When the data format reflects the correct data structure, just press the "Load Data in Memory" button. Obvious data errors like wrong date formats, or non numeric data will be picked up at that stage.

All data present on the selected sheet will be used except for a number of rows at the end of the file which can be held out i.e. ignored while optimizing. You may edit the data file prior to loading data into G.P.F. The number of quotes loaded will be the number of lines reduced by the number of header lines as well as the number of days ahead required by the pattern objective (fitness function).

3. Launching G.P.F. and analysing results

It is now time to launch the G.P.F. by pressing the "Start G.P.F." button. To keep things simple, the whole genetic set-up has been summed up in one single process.

A population of individuals or potential pattern candidates is first generated.  They all carry genetic traits of potential solutions, according to the given search space (availability of Open and Volume, 2 or 3-component patterns, number of bars back, additional filters, etc...).

A few genetic optimization parameters are made available to the more advanced user. Default values will however be sufficient in most cases.  Registered Ward Systems GeneHunter users may manually change the number of individuals in the population, as well as advanced parameters. While the chance of reaching a local optimum during the optimization process should not be ignored, the default population will suffice providing the search space remains realistic, i.e. for instance over a maximum of 14 bars.   The optimal population size is calculated according to your settings.

Once the optimization is completed, press the "Analysis" button to display statistical characteristics of top solutions.

The top patterns are listed there for further testing and validation, including Out-of-Sample statistical analysis. An Equity Curve and Trade Distribution are also provided in order to select the most suitable trading solution.  The shape of the equity curve remains the best validation tool.

Option is given to automatically design a TradeStation EasyLanguage signal from the selected solution. It is however recommended to combine different signals from separate optimizations in order to find the best entry and exit signals for your trading strategy.    A separate EasyLanguage library is also available to import your patterns directly into your Omega product.

[Back to Top]            [Back to GPF Page

Home Up Best viewed with MS Internet Explorer 5 and above

Page last modified: December 09, 2007
Copyright ForeTrade Technologies 21st century and thereafter