Click here to Login




How to create and trade a Neural Network model

Updated on 2011-11-18





Here is a simple example that shows you how to create, train and trade a Neural Network Model.

- In QuantShare trading software, open the "Prediction" manager by selecting "AI" then "Prediction"
- In the manager form, click on "Add" to create a new neural network model
- Click on "Next" then update the model parameters (Trading period, symbol(s), time frame...)

Example:

Start Date: 01/01/2005
End Date: 01/01/2011
Time frame: Daily
Symbols: GOOG
Samples: 60% learning, 20% validation and 20% for testing

- Click on "Next" then update the inputs and output for this model

Example:

Inputs: (Create two inputs using the "Add" button)
1- Double click on "Symbol Field", select "Formula" then type "perf(close, 1)". Under "WS", type "3" to create two additional inputs: Daily return one-bar ago and daily return two bars ago.
2- Double click on "Symbol Field", select "Formula" then type "perf(volume, 1)".

Output:
Only one output is allowed per neural network model. The output is the value that should be predicted by the model given the different inputs.

In this example, we would like to predict the next bar return, so we use "perf(close, 1)" as formula.

- Click on "Next" to display the neural network layers
- Click on "Next" to define the strategy associated with this neural net model. This strategy is calculated in each iteration.

Strategy:

Entry Rule: prediction > 0 (Buy Google stock if the predicted one-bar return is higher than 0)
Exit Rule: Click on "Select an Output", select "Use N-Bar Stop", click on "Add", set "Number of bars" to 1 then save the output by clicking on "OK".

- Click on "Next" to choose the stop training conditions
- Under "How to select the best model", select "StrategyMetric" then click on "Next".
- Type the name of the neural network model then click on "Finish"

To train the neural net model, select it in the "Prediction" manager form, and then click on "Train". The "Strategy" tab shows you the strategy's performance for each iteration.

In QuantShare Trading Software, here is how to plot the model predictions on a chart:
- Click on "Add Indicator" (first icon)
- Select "All Indicators", type "predict", select the first indicator, update "Category" and "Name" fields then click on "OK".

To use the Neural Network model in your trading system, type:
rule = Predict("Category Name","Model Name") > 0;










no comments (Log in)

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.