ML

How to use Neural Networks in Trading

7 min read

Volatility has always been one of the main characteristics of financial markets and investment management. Unfortunately, these markets are never stable and are highly susceptible to different events happening not only in the industry of economics and finances but also in such spheres as politics, technology, healthcare, etc.

Besides, changes in financial markets are not country- or even region-specific and are affected by global events and problems, and this sometimes makes trading really difficult. And this is where artificial intelligence, and specifically neural networks, can turn out to be really helpful. Do neural networks in trading really work? What is important to know when considering the use of this computing system? Let's find out together.

Table of Contents:

  1. Short introduction.
  2. What are neural networks?
  3. Neural network history in short.
  4. Case studies.
  5. The pros and cons of using neural networks in trading.
  6. Is it possible to predict stock prices with a neural network?
  7. The tools for building neural networks.
  8. Which software to choose?
  9. Conclusions.

What are neural networks?

So, what exactly are neural networks, and what makes one think they may enhance stock market predictability? Neural networks, also known as Artificial Neural Networks, are a type of machine learning that uses algorithms that resemble the work of the human brain, more specifically, the neuron interaction.

These networks have input layers, multiple hidden layers consisting of neurons, and output layers. Each neuron is connected to another one and has its weight and threshold. If the input data of one neuron appears to exceed that specific threshold, it is transmitted to the next layer; otherwise, no further transmission occurs.

The main feature this technology builds on is that it has self-learning capability so that it can analyze and categorize the previously input data and identify some price patterns that potentially can help predict future stock fluctuations and, consequently, earn money. Of course, neural networks are far from ensuring 100% accuracy, but once their algorithms are fine-tuned, they can be of great help.

Neural network history in short

  • 1943

The evolution of understanding the way neural networks work in the brain and how this work can be simulated in some machine learning started in 1943 in the work of Warren McCulloch and Walter Pitts, who compared neurons with a binary threshold by using connected circuits.

  • 1958

McCulloch and Pitts’ work was further developed into the model of information storage and organization in the brain by Frank Rosenblatt in 1958.

  • 1959

However, it was only in 1959 that the first actual neural network was introduced and used to solve a real problem, with Bernard Widrow and Marcian Hoff being behind the progress.

  • 1969 – 1974 – 1989

Then, there was the work by Marvin Minsky and Seymour Papert that proved the invalidity of Rosenblatt’s approach to neural networks in 1969, the Ph.D. thesis by Paul Werbos, who discussed backpropagation and its application to neural nets in 1974, and the work by Yann LeCun published in 1989 that explained how backpropagation could be effectively integrated into the neural network architecture to ensure algorithm training.

  • Today

Needless to say that the studies on the neural network are ongoing to further improve the possibilities of this computing system and machine learning in general and simplify neural network trading.

Application and case studies

Trade market sample

Neural networks are widely used all over the world by numerous companies and organizations, including renowned ones like Google (Google News, Google Assistant, Google Cloud Video Intelligence), Facebook (facial recognition software), Amazon (showing related or recommended products), and many others.

The technology is also being actively used in the financial sphere to predict and thus prevent fraud and various financial risks. For instance, SAS Real-Time Decision Management is used in banks to deal with different business issues by analyzing potential profits and predicting possible risks (for example, when deciding if a client is eligible for credit). The technology can also be used for bankruptcy prediction.

If to consider specifically the examples of the use of the neural network in trading, there are studies that prove the effectiveness of these networks. For instance, the study by Evans et al. shows that when applied to predicting the 3 most popular currency rates on FOREX, the model based on Artificial Neural Networks and genetic algorithms offers up to 72,5% prediction accuracy.

Another study by Martinez et al. suggests that when used as a stock market day-trading system, neural networks appear to be more accurate and give more profit to an investor than the four benchmarks to which the results of the neural networks were compared. Thus, it becomes obvious that neural network stock trading is possible and can be profitable.

The pros and cons of using neural networks in trading

To better understand the essence of neural networks, it is important to learn about their strengths and weaknesses. In the picture below, you can see the main pros of networks.

Main pros

Let’s discuss each of them in detail:

  • They have self-learning abilities. The output data they produce is not limited to the input data since they analyze the input data and can ‘make certain conclusions,’ providing new data.
  • They can detect patterns that are too complicated, comprehensive, and/or subtle to be detected by humans or other computing systems.
  • They can work with insufficient or inaccurate data since one or more corrupted neurons do not really impact the end output.
  • They are multitasking, meaning that they can run more than one task at the same time.
  • They can offer new opportunities that may improve trading performance.

Now, let’s take a look at the cons:

Main cons

They are definitely not failsafe. Even though they can be helpful in trading, the extent of that help can be rather insignificant. According to some studies, one’s trading performance can improve by only up to 10% with the use of neural networks compared to traditional analysis systems.

  • They cannot fully replace human analysis. Thus, an investor still needs relevant knowledge to understand the analysis of such networks, their impact on the trading strategy, and possible ways of improvement.
  • They are highly dependable on the training data. As a result, they become over-trained and may lose their ability to generalize.
  • They are often regarded as black boxes, and scientists cannot explain the results these networks produce.
  • Their training can be time-consuming and expensive.

Is it possible to predict stock prices with a neural network?

If this is the question you have in mind when thinking about neural network trading systems, then the answer is ‘no.’ But! If your question sounds like, ‘do neural networks aid in analyzing stock price data and uncovering opportunities?’ then the answer is ‘definitely yes.’ It is important to understand that such networks are neither forecasting tools nor advice machines.

They are a promising tool that can find non-linear patterns and interconnections that standard types of technical analysis cannot see. You also should keep in mind that it is the investor who does most of the work, not the network. It is the responsibility of the investor to invent an idea, shape it, test it, improve as much as needed after testing, and eventually discard it (yes, models of neural networks become obsolete with time).

Finally, remember that stock markets can be greatly affected by a number of global events, such as natural calamities, pandemics, economic collapses, international political affairs, country-specific radical events like revolutions and riots, wars, hostilities, and many others. The course of such events, in most cases, is highly unstable, and the aftermath is unpredictable.

Therefore, it is next to impossible both for the human brain and the neural network’s algorithm to actually forecast stock prices when any of such events takes place (unfortunately, such events have become quite frequent lately). Obviously, it is not sensible to expect any profitable insights from the stock trading neural network at the peaks of such events.

However, in between the peaks of these events, if you use the network properly, closely follow all the preparation stages of the network’s working cycle, spend enough time on training it, and, importantly, constantly and in a timely manner adjust their work to the changing realities, then you most certainly will get yourself a great financial helper.

The tools for building neural networks

There is a great choice of neural networks for stock trading. Among the top software, one could distinguish Neural Designer, Torch, Darknet, NVIDIA DIGITS, Keras, Neuroph, Microsoft Cognitive Toolkit, and some others. We will briefly describe some of them.

Neural Designer

It is one of the tools that help to create AI-based apps without the need to code. It has a high speed of learning, which means that you will get the analysis of financial trends faster compared to other software. It is easy to use, has a graphical user interface, and offers advanced analytics.

Torch

Because of the rather easy language it uses (LuaJIT), it is an efficient network with a number of effective features: fast GPU support, numeric optimization, linear algebra routines, high-power N-dimensional array, and many others. It has its own optimization libraries that developers can use to create various models.

Keras

Written in Python, Keras is a great neural network library that allows developers to carry out quick experiments with models. Some of its mean strengths are easy extensibility and minimalism coupled with modularity, which makes using neural networks for stock trading systems comparably simple. It can work both with recurrent and convolutional networks and with their combination.

Microsoft Cognitive Toolkit (CNTK)

It is an open-source set of tools one can use to create complex neural network models. This software can work with feed-forward, recurrent, and convolutional networks and is compatible with programs written in different languages (Python, C++, and C#) or can work as a separate machine-learning tool since it has its own language of model description. Such alternatives make this software quite practical.

Which software to choose?

The above are just a few examples of neural network software you could use to improve your trading performance, but in reality, there are much more of them. Each of them has its own strengths, and you can find the software that would suit your strategies and requirements the most. Still, you probably will not find an ideal one that will address all your requirements. Thus, even though it is always easier to use something that has already been created, making your software solution by employing neural networks and adjusting it to your needs and strategies will eventually prove more rewarding.

Neural networks are a promising solution to the difficulties of trading since they offer an investor new opportunities that he or she may never be able to detect, and this is why they are gaining popularity. Everyone who is professionally engaged in trading should consider employing this computing system, and if you do, think about creating your own custom software.

Stay updated with us

Browse our case studies and get actionable insights to drive your success

See more
Illustration inviting viewers to discuss their business needs

Share your software needs with us:

What happens after you get in touch?

  • 1

    Our expert will contact you within 12 hours to provide a consultancy and further support

  • 2

    We will clarify the requirements and set up an engagement process to make your journey smooth

  • 3

    Based on the info gathered and your business objectives, you’ll get a detailed project vision