Artificial intelligence always intrigued me. I can think of two main uses of artificial intelligence algorithms in forex: pattern recognition and predictors.
Pattern recognition is used to teach your system to detect special patterns and then embed it in an expert advisor as a trend detector or a signaling module.
The predictor is used to predict a certain price (such as the close price of a candle) and use it in the expert advisor. It doesn't have to be based on artificial intelligence.
A predictor/estimator is measured according to it's error. The error is defined as the difference between the real value and the predicted value.
Two properties of the error define the predictor's quality:
- The error's mean value
- The error's variance.
The process of using machine learning is divided into two stages:
1. Training - training the system with a sub-set of the training data
2. Testing - testing the trained system with the other sub-set of that data.
My idea was using the predicted daily bar's high and low prices for trading.
For that purpose I need a predictor which I chose to develop using a neural network. Such a system requires data. The input data for the predictor is the last N bars (Open, Close, High, Low) and it's output is the predicted high price and low price. Later I found that the open and close prices doesn't really matter but I used the current day's open price for that.
So the input is the last N bars high and low prices, and the current day's open price. That's the data needed for predicting one bar's prices. I had to collect the same kind of data for each bar that was part of the training. I wrote a script in Metatrader that collects all the data for the training phase.
At that point I need a good neural network tool. There is a library called FANN but it's performance were poor. I had no choice to work with MATLAB. The performance of MATAB was much better from the error point of view, but it's very slow.
Now the big question is how can I use such a predictor? Suppose you know with a high probability and small error what would be the current day's low/high prices, what would you do?
One option is to use those prices as targets. The other is as entry prices.
I chose the second option.
In addition I checked statistically the error and created a distribution of the error. Using that distribution I created a graph of entry prices which may be used a grid.
How?
Suppose that in 50% of the cases the predicted low price was lower than the actual low price,
And in 60% of the cases the predicted low price - 10 pips was lower than the actual low price.
In that case if the trend is long the money may be divided between those levels according to their probabilities. Sometimes the -10 pips level won't be hit at all. It's a game of numbers and probabilities.
How to spread the risk among the levels vs. the probability that it would be hit.