Neural Network

 

Neural network is one of the more recent buzzwords in trading. It sounds cool and sophisticated. Not too many people seem to understand what neural networks are all about.

Neurons in the Real World

Our brains are phenomenally complicated. What surprises most people, however, is that the brain is more or less an enormous box of circuits. Neurons are cells that act like circuits with “electrical wires”, called axons, that run out and connect across the human body. Every motion, perception or action that you do is the sum of all the axons firing electrical impulses. Change occurs whenever the frequency of electrical impulses sent from the neuron varies. More impulses cause one reaction, a reduction causes another.

Neural networks attempt to emulate processes of the human brain by organizing information into neurons. Unlike actual neuron cells, a network neuron only exists in the machine. It’s a machine weight that contains information about whatever is under study.

A neural network for a trading system might decide to study common indicators like a moving average, the RSI and Stochastics oscillator. The moving average value for the current bar counts as its own neuron. The RSI is different, so it gets to be a separate neuron. If I have ten indicators in my toolbox, then I have 10 neurons in my network.

Computers traditionally solve linear, simple problems. If you want to know the result of mathematical operations like the cube root of 355, computers are perfect for the task. They rapidly calculate a precise answer.

As in human brains, neural networks form synapses with other neurons. When trained, groups of neurons can learn to recognize patterns. It is this property that makes neural networks so useful. This allows us to create programs that would be impossible with traditional computing. Creating a software program to recognize a face, for example, would be extremely difficult. It is much easier to train a network to recognize a face by repeatedly showing the network faces.

The brain is a fascinating topic in its own right. As an aside, my wife and I are taking a survey course in neuroscience through a video series of The Great Courses. If you have any interest at all in the subject matter, I highly recommend Understanding the Brain by Jeanette Norden. It covers in detail how neurons connect to anatomy throughout the brain and entire body.

Neural Networks and Forex Trading

Neural networks come into play when the answer is not so precise. Sticking with this blog’s theme of forex trading, there is no right answer to what makes the perfect trading system. A typical retail investor might say the best trading system is the one that makes the most money. Another might say the best trading system is the one with the highest Sharpe ratio. Many want something in the middle.

The “best trading system” problem is ambiguous, which makes it an ideal candidate for attacking with neural networks. The designer outlines sets of rules which, in the trader’s opinion, form a numerical way of measuring the best system.

Human brains host approximately 100 billion neurons. Despite the best efforts of many of our customers, I have yet to meet anyone with 100 billion market indicators at their disposal. One way to amplify the effect of neurons in our toolbox is to create hidden layers.

A network is made up of multiple layers, each made up with multiple neurons. Each neuron is connected to every neuron in the next layer. Every connection then carries its own unique weighted value. A neuron will pass on its value by multiplying the value of the neuron and by the weight of the outgoing connection. The neuron at the end of the outgoing connection will sum up all of its incoming connections and propagate that result onto the next layer through all of its outgoing connections.

Pictures make the idea far more intuitive. Figure 1 contains a small example. The 2 and 3 on the left are the inputs into the network. These inputs get multiplied by the weight of the connection to the next layer. The 2 is multiplied by 0.5 giving us 1, and 3 by 2 giving us 6. The second layer contains one node which sums up the results from the previous layer, giving us 7. The next step would be to multiply 7 by the weights on the outgoing connections and pass it onto the next layer.

Figure 1: An example of a neural network propagating results forward.

The short example above can be repeated and chained together to form a larger network. Below, in Figure 2, we have an example of a larger network. The example network has 3 inputs which are connected to a hidden layer. The hidden layer is then connected to a single output. The hidden layers are to facilitate training. The more complex the problem the more layers and nodes needed.

Figure 2: An example of a larger neural network.

The network learns by updating the weights of its many connections. There are many software algorithms that are used to accomplish learning in neural networks. They fall into two categories, supervised learning and unsupervised learning. Supervised learning is accomplished with the user telling the network if its predictions are correct or not. The network then calculates its error and uses one of the algorithms to correct the mistake. An example of this is reverse propagation, which calculates the error of a network’s prediction. The network then uses a quick algorithm to update each of the connection weights with that error. Reverse propagation is one of the more common training strategies.

Unsupervised learning uses some type of fitness or scoring algorithm in which the network will score itself with and try to improve on every subsequent attempt. An example of unsupervised training is the genetic algorithm. This algorithm creates a population of neural networks and uses a scoring algorithm designed by the user to rank the population. After that, it is survival of the fittest. The top ranked networks get to stay and “reproduce” and the bottom ranked get thrown out. The networks reproduce by mixing and matching connection weights.

Neural networks can substantially assist systems traders in their algorithm design by exploring billions of combinations among a relatively small toolbox of indicators. This differs from standard optimization, which involves plugging numbers into various indicators looking for whatever combination returns the most money.

The fact that networks can consider multiple measures (balance, Sharpe Ratio, etc) to determine the best trading system helps reduce the likelihood that it overemphasizes one particular measure. A good example of this is account balance. If a system weighs the give and take between the net return and the risk adjusted return, it starts to step away from number crunching to discover the best numbers to use and head towards actual learning and pattern recognition.

Neural networks are proving themselves to be very useful in a wide range of applications from facial recognition to currency market predictions. They excel where there are patterns that are difficult for us to recognize. That ability makes networks invaluable in solving difficult problems involving multiple variables.

 
Neural Network

Share this Post

 

Tags

, , ,

Related Posts

About the author

Shaun is a passionate and proud nerd on a wide variety of topics, most of which have absolutely nothing to do with each other. He loves math and systems, which makes him a natural fit for designing trading systems. The most random fact about him is that he speaks fluent Arabic.Shaun's hobbies are running, church and spending as much time as possible with his wife and two young boys.

 
 

0 Comments

You can be the first one to leave a comment.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>