Those who believe in stock market prediction consider that stock price movements do not follow a random walk and thus it is possible to predict these movements. There are several techniques and algorithms commonly used in stock prediction. These techniques or algorithms work usually the same way; that is, the system receives inputs, processes these inputs and then returns an output signal. The output is then used to obtain the prediction.
Among all these stock market prediction algorithms, the artificial neural networks - ANNs - are probably the most famous ones. Neural networks mimic the mechanisms and the way human brain works. ANNs have been applied with success in many real world problems and in so many domains and industries, including the stock market, robotics, face recognition...
What to Predict
In the stock market, there are several things traders can predict. We can for example predict the next close price of a market index such as the S&P 500 or a particular stock. We can also predict the next day stock direction or the next five days rate of return. Anything can be set as an output function and consequently, QS trading software can (try to) predict any variable/time series/indicator you give him.
Let us use an example to explain the basics behind a neural network system. First of all, let us say that a neural network is composed of one or several inputs, one or several hidden layers (each layer contains one or several neurons that are connected with other layer's nodes) and one output.
The first input gets a time series (A series of values, for example: the stock close price or the 10-Bar simple moving average of the close price). One by one, the values that compose the time series will be used to train the neural network system.
An Example of How the Whole Process Works
We have a neural network system with three inputs. The first input is the close price, the second one is the volume and the third one is the one-bar rate of return. We will try to predict the direction of the stock for the next day.
Learning Process of a Stock Market Prediction Model
For each trading day, the neural network prediction model will get the value of each time series and then send them to the appropriate input neuron. The neuron will then use its transfer function and its weight to calculate a new value and then send it to each neuron that belongs to the next layer. These neurons will also process the data using their own weights and transfer functions and transfer the result to neurons of the next layer until we reach the last layer. The last layer contains the output neuron. It gets all the neurons values of the preceding layer and produces a final prediction value.
If the predicted value is not equal to the real value (for example the model returns 1, which means that the stock will increase the next day, while given the learning sample the stock in fact decreased) then an algorithm called back-propagation algorithm is applied in order to update neuron weights so that the value produced will be equal to -1 (Stock decreased in the next day).
This stock market prediction process is repeated and a network error as well as other several metrics is calculated in each iteration. Usually the learning process is stopped after a specific number of iterations or when the network error (or any other measure) becomes lower than a specific threshold.
During the learning process, another sample of values is used to validate the learning process. This sample is extracted from the validation period, which should be different from the sample used in the learning period. After that, the system is tested using values from the testing period to see how our Stock Market Prediction Model performs on unknown data.
After this stock price prediction model is created is trained and if the result is good, you can use the "Predict" function to reference this prediction model from your other formulas (Screener, watchlist, trading system, chart...).
Example of usage: (In this example, "model name" predict next bar close)
a = Predict("", "model name");
buy = a > close; // Enter a long position if our stock price prediction model predict a higher close price for tomorrow (or next bar if you have created the model using intraday data)
This was a simplified example on how stock prediction using neural networks works. Next week, we will show you how to create a neural network prediction model using QuantShare.
Here is a link of a blog post that shows you how to use QuantShare to perform stock market prediction using the neural network algorithm:
Stock Market Prediction with QuantShare
Stock prediction using Neural Nets (How-to articles):
How to create and trade a Neural Network model
How to optimize a neural network using a genetic algorithm