Click here to Login

How to optimize a neural network using a genetic algorithm

Updated on 2011-11-19 03:54:45

Share |

If you haven't yet created your first neural network prediction model, I strongly suggest you look at the how-to lesson: How to create and trade a Neural Network model

A Genetic algorithm is an evolutionary algorithm that tries to solve optimization problems using techniques inspired by the natural evolution.

An example of an optimization problem is: Given several neural network inputs, which ones should I choose in order to generate a prediction model that is likely to be the most profitable.


- In QuantShare trading software, select "AI" then "Optimizer"
- In the Optimizer Manager form, click on "Create"
- Select "Genetic Algorithm" then "Prediction Model" in the "What do you want to optimize?" list
- Update the genetic algorithm parameters then click on "Next". Example: for a quick optimization, set low values in the "Number of generations" and "Population size" fields.
- Click on "Select a prediction item" then select a neural network model
- Add as many inputs as you want. The optimizer will try to find the inputs combination that gives that highest fitness value.

Example of Inputs:
Relative Strength Index - RSI
Moving Average of the trading volume
Put/Call Ratio
Relative strength between a stock and the main market index
10-Bar Rate of Change

To create an optimization based on the neural net underlying trading strategy, type the following fitness formula:

Fitness = StrategyMetric;

- Click on "Next" twice then save your optimize item

To start the optimization of the neural network based on a genetic algorithm, select the previously saved item in the "Optimizer Manager" then click on "Run".

no reviews (Log in)

Other how-to articles

How to create and trade a Neural Network model

How to plot a stock using different periods in the same chart

How to optimize an indicator in your trading system

How to draw an horizontal segment line using QS language

How to optimize the stop limit of a trading system

How to perform a basic quantitative analysis using the S&P 500

How to get stocks for a particular index using the global script

How to debug a trading system using the money management tool

How to calculate the average of a time series using the money management tool

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.