Machine Learning in Trading: Differences between higher and lower time frames

About two years ago I started my journey into the development of trading systems using machine learning techniques, particularly neural network based systems using the FANN (Fast Artificial Neural Network) library. However after the development of several systems, including successful implementations using both direct price information and image processing (reading directly from charts) I then decided to explore other machine learning techniques that were potentially faster and more powerful than neural networks in the prediction of financial time series. Following several articles by Belo and Barbosa – mentioned along my previous posts about machine learning – I started to develop ensembles of different machine learning techniques, studying the differences between them and how they were affected by inputs, outputs, etc. Today I want to talk a little bit about the big differences in building a machine learning technique for the higher and lower time frames and why the lower time frames represent a much larger challenge than the higher ones.

When you develop a machine learning technique for trading you are generally searching for a method that allows you to predict a given outcome that translates directly into an inefficiency (a net positive, long term monetary gain for you). This means that you will generally attempt to predict both the future direction of price and its magnitude, so that you can get a good idea of how much money you will be able to make if your prediction is right. My approach has generally been to attempt to predict the direction/magnitude of the next bar in a price series and this can be quite successful for the higher time frames with the appropriate input/output structures. The reason is simply that the daily time frame bars are large and therefore the movements within them are easier to predict than the movements within a lower time frame, which are inherently more random. Applying this simple methodology – attempt to predict the next bar(s) – leads to huge failure along the lower time frames and therefore this technique is limited to only higher time frames (but even then it’s likely to be sub-optimal).

4-16-2013 9-05-10 AM

Looking at the way in which regular trading systems are developed – through mathematical expectancy analysis – it soon becomes clear that when you develop a system using machine learning you should aim to look for trade entries that have a high chance of success towards a predefined profit target and position holding time. This means that you shouldn’t train a system in order to learn if the next hourly bar (or the next ten or twenty or fifty for that matter) will be bullish or bearish but you will simply train it to give you an idea of whether – if you had entered a trade on that bar – after X time you would have eventually reached your profit target before your loss target (this takes into account the whole price range (high/low) movement). This means that you train your system to distinguish circumstances that lead to favourable movements  within a given predefined maximum holding time, without constraining your strategy to trying to predict the outcome of a particular time period. The inputs used to define the machine learning method are bound to be similar, so the outputs are marking the main difference between this approach and the more basic “predict if the outcome is bearish or bullish for the next bar(s)”.

It is no secret that up until now my success in the development of machine learning techniques for the lower time frames has been very limited but I believe that this is precisely due to the above issue dealing with the way in which I have been designing my predictions. Attempting to predict if the net movement for the next bar(s) will be positive or negative leads to very frequent trade entries – as your machine learning technique tends to predict one or the other – while having an output that attempts to forecast the success of an actual trade entry (whether you will reach the profit target before the loss target) is something much more in line with what we want as we are directly training the system to reach a predefined trading goal. With this type of output you can trade a clearer probability for trade success or failure while the “next bar(s)” prediction does not allow you to take into account the total price excursions but merely a very limited view of the open/close differences of the selected period.

4-16-2013 9-21-56 AM

This is perfectly in line with the work of Belo and Barbosa and other academics who have postulated that higher time frames are more profitable for machine learning because they seem to be more predictable (have less noise). The issue, as explained above, is most likely related with the way in which they are trying to predict things. Certainly it is extremely difficult to predict the outcome of the next 15 minute or 1 hour bar while predicting the outcome of the next daily bar is much easier, the reason is that the daily bar is simply much bigger and therefore its movement represents overall market phenomena much more clearly. The problem here is that you’re trying to predict the wrong thing. I believe there is no reason why you cannot achieve a profitable 1H system using machine learning, but it seems naive to believe that you can do this by predicting the next 1H bar (which is very difficult) but you should instead predict your chances of success if you entered a trade now and you want to hold it for a maximum of, for example, 10 hours.

My next goal in the development of machine learning strategies will be to tackle the issue of lower time frame machine learning systems using the above mentioned approach. I will first try simple linear/kernel  classifier models that are bound to be much computationally lighter and I will then switch to more advanced models such as neural networks and support vector machines. I have yet to see if the above mentioned technique will be successful in machine learning but my first experiments point to some preliminary success. I also want to know if I can also achieve success without the use of binary classifiers but simply by predicting directly the mathematical expectancy values of a trade taken at a given point in time with a defined holding time. Do you have any ideas to develop better machine learning systems for the lower time frames ? Do you have any opinion about my proposed design ? Leave  a comment with any questions or suggestions!

If you would like to learn more about machine learning techniques and how you too can use libraries such as FANN and shark to design trading strategies  please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)

You can skip to the end and leave a response. Pinging is currently not allowed.

3 Responses to “Machine Learning in Trading: Differences between higher and lower time frames”

  1. Tad says:

    Sounds like a great idea on how to successfully trade on the lower time frames. You might want to try adding a very simple filter such as a moving average or the average daily range. Trading with the trend could be great way to further cut down on bad trades. Sometimes these machine learning algorithms can benefit from even something as simple as an MA cross.

    There is an interesting paper on this topic that you might useful.

    http://researchcommons.waikato.ac.nz/bitstream/handle/10289/5602/Mayo%202011%20Hybridizing.pdf?sequence=1

  2. pips.maker says:

    When you write about 10 hours aren’t you really switching to higher time frames, but artificially calculated. Higher profitability of such solutions was mentioned on this blog and left for further investigation…

  3. Jan says:

    Hi Daniel,

    Murray Ruggiero writes about these topics in several articles in Futures Magazine:

    http://www.futuresmag.com/author/murray-a-ruggiero-jr

    Probably the best way is to use neural nets to enhance an already robust strategy (e.g.: a dual moving average crossover system). It’s easier for a NN to predict a MA crossover 1 to 3 days ahead, than to predict the market itself. If the NN degrades to random signals, the basic MA crossover strategy does not degrade much. Even when the NN gives signals opposite of what it should be, the basic strategy does not degrade as much as it benefits from correct signals.

    Maybe this is worth investigating…

    Greetings, Jan.

Leave a Reply

Subscribe to RSS Feed Follow me on Twitter!
Show Buttons
Hide Buttons