Example 12
Unoptimized Prediction of FOREX
In this example we introduce neural network predictions, and we use a FOREX instrument since they are so popular these days. However, the techniques explained herein are just as applicable to stocks, commodities, futures, etc.
Neural nets are useful when you have some idea of some predictive indicators, but have no idea how to put them together into some sort of set of rules for trading. Neural nets make predictions (the output) about the future value of some data series based on some indicators that you feed into them (inputs). It is best if the data series you are predicting indicates a buy when it rises. The neural net uses some historical data (the training set) to “learn” how to make accurate predictions of the output using the inputs. NeuroShell teaches the nets how to make those predictions, a process called training. You do not need to know how neural nets do this learning in order to use them effectively, but the reference section of our help file contains books that will explain the math behind neural net training if you feel you need to know. Just remember that there are many, many types of neural nets, and something you study about one type may not be applicable to other types, like ours.
The Prediction Wizard not only trains the neural net, but applies the threshold rules to the predictions in order to decide whether to buy or sell. For practical purposes, it is best to let the optimizer choose the thresholds, but in our first prediction example we will not do that.
For example, if the neural net is predicting the percent change in open over the next 3 days starting with tomorrow’s open, some of the most simple rules (and the ones used in this example) might be:
If prediction > 0% then enter long
If prediction < 0% then exit long
If prediction < 0% then enter short
If prediction > 0% then exit short
In this FOREX example we are using daily GBP/USD pair bars, because we have found it easier to model than the more popular EUR/USD. We know that regression lines (straight lines) placed through past closes are often somewhat predictive of the future if we measure the slope of such lines. Positive slopes mean rising prices, negative ones mean falling prices. In the chart we inserted the slope measurements of straight lines each 10 bars long. One slope is of the line through the most recent 10 closes, the next through the 10 bars before that, etc. The straight lines aren’t actually plotted on the chart, it is the slopes we need. The indicator we used to measure the slope of an (unplotted) regression line can be found in the Regression category. You will see it on the chart in purple.
Then we took 10, 20, and 30 bar lags of the indicator in purple. This measures the 10 bar slopes of the curve 10, 20 and 30 bars back.
Through hours of inspection we might be able to figure out some buy/sell rules based on these past slopes to put into a trading strategy, but why bother? Instead we put them into a neural net prediction. Double click on the prediction legend to bring up the Prediction Wizard, then go backwards and examine how we built the net. Here are some points to notice:
-
We are predicting the percent change in open 8 bars from the next open
-
We did not optimize the 4 inputs
-
We built the neural model using the whole chart as a training set
-
We selected our own threshold rules (as shown above)
-
We defaulted to 10 “hidden neurons”. Hidden neurons are a technical aspect of nets. The main thing you need to know about them is the more you use the tighter the curve fitting will become
Now here are some cost related aspects to note:
-
We are trading 10,000 units of GBP
-
We assumed costs of 3 pips side (many brokers don’t charge a commission, but the spread can be several pips, Sometimes brokers charge only one side.)
-
We assumed 1% margin
Usually, once we build trading strategy or prediction, we like to hide the close. In this chart we left the close in so we can show you how it can be formatted to distinguish between increasing and decreasing bars. To see how we did this, right click on the Close legend and choose “Format selected data”.
Copyright © 1997-2011 Ward Systems Group, Inc. All rights reserved.