# Algorithmic trading using machine learning techniques

Johann Christian Lotter has a degree in Physics and founded a software firm that started out developing computer games. For several years now he has been working with algorithms for data analysis and machine learning.

His company has developed more than trading systems for institutions and private traders. To me, there are two main methods for developing automated trading strategies: A model-based strategy starts with a model of a market inefficiency that results from trader psychology, the economy, market microstructure or any other force affecting price.

This inefficiency produces an anomaly in the price time series - a deviation algorithmic trading using machine learning techniques the random walk - that can sometimes be used for price or trend prediction.

Examples of model-based trading methods are trend following, mean reversion, price cycles, price clusters, statistical arbitrage and seasonality. A machine learning strategy works the other way around. It data mines price time series or other data algorithmic trading using machine learning techniques, looks for patterns that repeat and attempts to fit a trading algorithm to them.

The market forces behind those patterns are of no interest. The only assumption is that patterns of the past might reappear in the future. The advantage of pure machine learning is that it does not rely on any assumptions, models or market hypotheses.

Machine learning algorithms tend to detect a vast number of random patterns and generate a vast amount of worthless strategies. Distinguishing real patterns - caused by real market inefficiencies - from random patterns can be a algorithmic trading using machine learning techniques task. Still, machine learning is evolving fast and will probably dominate trading strategy development within the next decade. It is time to take a closer look. In this article I will describe the typical development process of a machine learning strategy.

I will use a deep learning algorithm for trading 'price action' - predicting short-term price moves algorithmic trading using machine learning techniques short-term price history.

With today's software tools, only about 20 lines of script code are needed for this. You can easily reproduce the strategy since all steps are described, all code is available and only open-source standard software packages - R and Zorro - are used. Zorro is used for tests and live trading, while R is needed for the deep learning algorithm. The strategy is mainly intended as an experiment for answering two questions: Does a more complex algorithm - such as adding more neurons algorithmic trading using machine learning techniques an artificial brain - produce a better prediction?

And can 'price action' trading work at all? For this we will collect information from the last candles of a price time series, feed it into a deep learning neural network and use its output to predict the next candles. Price action trading is irrational since a few candles do not contain any useful predictive information.

Of course, a nonpredictive outcome of the experiment will not inevitably mean that I am right since I could have used wrong parameters or prepared the data badly. But a predictive outcome would be a hint that I am wrong and price action trading can indeed be made to work. A machine learning algorithm is trained for predicting something. In trading, this is usually the direction of price or the outcome of the next trade.

For this purpose it is fed with data samples, derived in some way from historical algorithmic trading using machine learning techniques time series or other data sources. Each sample consists of a number n of variables x 1x 2The predictors can be the price returns of the previous n bars, a collection of classical indicators, any other imaginable functions of the price time series or external data such as a Twitter feed.

I have even seen the pixels of a price chart image used as predictors for a trading strategy. The main requirement for predictors is that when combined they carry information sufficient to predict the outcome with some accuracy. This outcome is represented by a target variable y. It might contain the return of the next trade or the next price movement. In a training process, the algorithm learns to predict the target y from the predictors x 1x 2The learned 'memory' is stored in a data structure that we named 'model' not to be confused with a financial model.

This data structure is specific to the algorithm. So the machine learning algorithm works in two modes, algorithmic trading using machine learning techniques training mode for generating the model and in prediction mode for predicting the target:. We will use a deep learning neural network for our experiment. A neural network consists of artificial neurons that are usually connected in an array of layers. There are other network structures but they are not of interest to us here.

Algorithmic trading using machine learning techniques neuron can be understood as a sort of electrical device with many inputs and a single output. The signal at the output is a weighted algorithmic trading using machine learning techniques of the signals at the inputs, modified by a mathematical function known as the 'activation function'.

The input weights constitute the 'memory' of the neural network. The output of every neuron is connected to the inputs of all neurons of the next layer as shown in Figure A neural network learns by determining the weights that minimize the error between sample prediction and sample target.

This requires an approximation process, normally with backpropagating the error from the output to the inputs, optimizing the weights on its way. This process imposes two restrictions. Second, a standard neural network cannot be too deep; it must not have too many 'hidden layers' of neurons between inputs and output. Otherwise, the usual training process will fail. This second restriction limits the complexity **algorithmic trading using machine learning techniques** problems that a standard neural network can tackle.

More complex problems that require neural networks with many hidden layers and thousands of neurons can algorithmic trading using machine learning techniques approached with 'deep learning' methods.

They became popular in recent years for various tasks, such as beating the world's best human Go player. Deep learning applies various methods for pre-training the hidden neuron layers and this way achieves a more effective learning process. For our experiment we will use such a deep learning method: But whether you are using a complex or a simple algorithm for machine learning, developing a machine learning strategy is usually the same process that I have broken down into eight steps.

First, we have to determine the target for training and prediction. A popular target, used in most papers, is the sign of the price return at the next bar. Better suited for algorithmic trading using machine learning techniques, as it is less susceptible to randomness, is the price difference to a more distant prediction horizon, such as three bars from now or the same day next week. Like almost anything in trading systems, the prediction horizon is a compromise between the effects of randomness fewer bars are worse and predictability fewer bars are better.

Sometimes you are not interested in directly predicting price but in predicting some other parameter - such as the current leg of a Zigzag indicator - that could otherwise only be determined in hindsight. Or you want to know if a certain market inefficiency will be present again - especially when you are using machine learning not directly for trading, but for filtering trades in a model-based system.

Or you want to predict something entirely different, for instance, the probability of a market crash tomorrow. All this is often easier to predict than tomorrow's return. In our price action experiment we will use the return of a short-term trade as target variable.

Once the target is determined, the next step is selecting the features for predicting it. A price time series is the worst case for any machine learning algorithm.

The exact ratio of signal and noise depends on what is meant by 'signal', but it is normally too low for any known machine learning algorithm to produce anything useful. We must derive features from the price time series that contain more signal and less noise.

All the rest is noise. Feature selection is thus critical for success - much more so than deciding which machine learning algorithm you are going to use. There are two approaches for selecting features. The first and most common is extracting as much information from the price time series as possible. Since you do not know where the information is hidden, you just generate a broad collection of indicators with a wide range of parameters and hope that at least a few of them will contain the information that the algorithm needs.

This is the approach that you normally find in the literature. The problem with this method: Any machine learning algorithm is easily confused by non-predictive predictors, so it won't help to just throw indicators at it.

You need some pre-selection algorithm that determines which of them carry useful information and which can be omitted. Without reducing the number of features this way to around eight or ten, even the deepest learning algorithm will not produce anything useful.

The other approach, normally for experiments and research, is using only limited information from the price time series. This is the case here: Since we want to look into price action trading, we only use the last few prices as inputs and must discard all the rest of the curve.

This has the advantage that we don't need any pre-selection algorithm since the number of features is limited anyway. Feature variables must fulfill two formal requirements for most machine learning algorithms.

First, all values should be in the same range, like -1, Second, the samples should be balanced, algorithmic trading using machine learning techniques means equally distributed over all values of the target variable.

When you use the outcome of a trade as target variable, there should be about as many winning as losing trades. If you do not observe these two requirements, you won't get good results. Listing 01 shows the two simple predictor functions that we use in our experiment in lite-C.

The two functions are supposed to carry the necessary information for price action: The change function is simply the difference of the current price to the price of n bars before, in relation to the current price.

The range function is the high-low distance of the last n candles, also in relation to the current price. It is not a good idea to use lots of predictors, since this simply causes overfitting and failure in out-of-sample operation. Therefore, machine learning strategies often apply a pre-selection algorithm that determines a small number of predictors out of a pool of many.

There are many methods for reducing the number of features, for instance:. Determine the correlations between the signals.

My name is Patrick Algorithmic trading using machine learning techniques. My research project is entitled Emerging machine learning technologies for algorithmic trading, which algorithmic trading using machine learning techniques on improving profitability whilst reducing risk and **algorithmic trading using machine learning techniques** within algorithmic trading through the adoption of novel machine learning methods and techniques. Since the introduction of electronic exchanges in the late 20th century, there has been a proliferation of diverse trading algorithms within the trading community.

The financial benefits associated with outperforming the market and gaining leverage over the competition has fueled the research of computational intelligence within financial information systems.

The most lucrative form of algorithmic trading is high-frequency trading. Algorithmic trading is rapidly replacing human traders across other asset classes.

This, coupled with the globalization of markets, is changing the nature of financial markets and obviating the need for research in order to better understand the effects of algorithmic trading and to protect against exceptional events, such as the Flash Crash of May 6,caused by a rouge trading algorithm SEC. Instead of relying on algorithmic trading using machine learning techniques interpretations of market behavior, machine learning techniques can be used to infer viable explanations of patterns in financial time series.

One desirable property of such techniques is the creation of transparent and comprehensible trading models. Not only do such models provide insight into market behavior, but can be used to develop profitable trading strategies whilst minimizing risk and trading costs a multi-objective optimization problem.

This is especially valuable to fund managers in their quest to decipher the rationale behind bad trades. It is widely known that different asset classes possess their own characteristic properties. This raises the question if some machine learning techniques are more appropriate for certain markets. Other factors that might influence such a decision, are contract types and trading frequencies. Trading algorithms also need to adapt to continuously changing markets and regime shifts.

Many high-frequency trading algorithms are in demand of high performance computing HPC. This necessitates the development of parallel and distributed machine learning techniques.

Lastly, algorithmic trading includes techniques for data acquisition, preprocessing, trade signal generation and trade execution. Algorithms for trade execution include the splitting and scheduling of large orders and finding pools of liquidity across different venues. This is especially important for institutional traders and brokers. The incorporation of machine readable news feeds and sentiment-based data feeds are highly relevant research areas. The main aim with my research is to explore the diverse landscape of various machine learning techniques and to compare their performance in various algorithmic trading scenarios in order to gain an understanding of which machine learning techniques are most appropriate to use algorithmic trading using machine learning techniques various scenarios.

The main goal with the research is to identify and improve novel, data-driven machine learning algorithms in order to increase profitability whilst reducing risk and costs in algorithmic trading. The research will cover most issues outlined in the motivation above. So far, one cognitive machine learning technology, Hierarchical Temporal Memory HTMhas been researched and benchmarked against recurrent neural networks in a high-frequency trading scenario for an equity index futures market using a trend-following strategy and an evolutionary optimization method 2 papers.

One evolutionary machine learning technology, based on context-free grammars, Grammatical Evolution GEhas also been researched in a high-frequency trading scenario for an equity index futures market, producing a risk-averse, mean-reverting trading strategy 1 paper. Both algorithmic trading using machine learning techniques created profitable trading models when back-tested and paper-traded on previously algorithmic trading using machine learning techniques data trading costs were accounted for, but not slippage due to market impact and liquidity.

GE also produces transparent, comprehensible trading models. Emerging machine learning technologies for algorithmic trading. Patrick Gabrielsson My name is Patrick Gabrielsson. Basic Motivations Since the introduction of electronic exchanges in the late 20th century, there has been a proliferation of diverse trading algorithms within the trading community. Aim The main aim with my research is to explore the diverse landscape of various machine learning techniques and to compare their performance in various algorithmic trading scenarios in order to gain an understanding of which machine learning techniques are most appropriate to use in various scenarios.

Supervisors and Mentors People directly involved in my research are: Contact Patrick Gabrielsson patrick.

Rockefeller (1839-1937), choose View Network Connections. What resistance is associated with each common-mode half-circuit. 3) to avoid confusion with R flrex for radius (Table A.