Artificial intelligence is the academic field of study which studies how to create computers and computer software that are capable of intelligent behavior. According to Wikipedia definition “Artificial intelligence is the intelligence of machines, where an intelligent agent (system) perceives its environment and takes action which maximizes its chances of success.
Adoption of Machine Learning
Machine learning is a subset of AI dedicated to classifying and finding patterns and extrapolates it to new data. We see a lot of machine learning applications implementation. Netflix uses machine learning based algorithm to select the top movies to be recommended. Amazon shopping portal uses machine learning technique to recommend the shopping items based on the recent search and other recognizable patterns.
Machine Learning in Trading
In this article we ask the question, ”Whether machine learning techniques can be used in stock trading?” The answer is resounding “Yes”! In fact, there are hedge funds that are purely based on AI, namely Rebellion Research and KFL Capital. Machine learning is logical and overcomes human limitations. This is important in trading where emotions can lead to pitfalls when it comes to decision making. Machine learning is classified into supervised learning and unsupervised learning. Unsupervised learning is the ability to find patterns in a stream of data without labeling the data. An example of this type is a self-organizing map (SOM). Limitation of this type is that parameters on which the data should be categorized are not specified. In supervised learning classes/labels of training data is specified. Example Support Vector Machines (SVM).
Support Vector Machines (SVM)
SVM analyze data and recognize patterns. Originally proposed by Boser, Guyon and Vapik in 1992, SVM gained increasing popularity and are currently among the best performers for a number of classification tasks ranging from text to genomic data.
As an example of applying SVM to trading, we will consider a moving average crossover strategy. In a moving average crossover there are two moving averages that are considered SMA (Short Moving Average) and LMA (Long Moving Average). If SMA crosses LMA from below it’s a buy signal and if SMA crosses LMA from above it’s a sell signal. Nifty (NSE) data for six years is considered for this example. If the price on the current day is higher than the previous day, a category called +1 is assigned. Similarly, if the price on the current day is lower than the previous day, a category called -1 is assigned. A category of 0 is assigned if there is no price change between consecutive days.
Predictions are made based on the data clustering. The large sections of data-points are in the +1 zone and very few data-points in the -1 zone. The overall distribution of the data is observed and predictions can be improved by widening the range from +1 and -1 to say +5 and -5. A substitute for widening the range is neural networks. Packages are available in R and you can build layers of neural networks.
The bottom line is to buy low and sell high. This is accomplished by using machine learning techniques that detect a pattern in the data and make predictions. Model building is the crucial part of the trading strategies. Based on the past data and it’s clustering around the data points predictions for the future are made. There are many models, Hidden Markov Model, decision tree, random forest to name a few.
We at Quantinsti, have dedicated curriculum for algorithmic trading famously knows as EPAT (Executive Programme in Algorithmic Trading). For more details about this certification feel free to connect with us.
Here is a step-by-step technique to predict Gold price using Regression in Python. Learn right from defining the explanatory variables to creating a linear regression model and eventually predicting the Gold ETF prices. This is a fundamental yet strong machine learning technique.