Building a Multi-currency Machine Learning Forex Strategy for the 1H Time frame

I have written many posts within the past few years about the building of machine learning strategies for the Forex market. You’ll notice that the two main areas that I have always struggled with have been the creation of multi-currency systems and the creation of profitable systems for the lower time frames (below the daily). Although I have made some progress related to multi-currency systems (see this post), the creation of lower time frame systems has always been difficult due to both the added computational cost of lower time frame simulations and the lack of a good input/output structure that worked across anything other than the daily. However my latest research around the randomness of lower time frames has prompted me to revisit this area and today I am glad to share with you some results surrounding the creation of my first historically profitable machine learning strategy that works both on lower time frames and across several different instruments. On today’s post I am going to talk a little bit about how I achieved this and what this may mean going forward.

2014-07-05_18-48-54

Let us first start with why I had never been able to create something that worked on the 1H time frame and why I decided to revisit my previous work. My previous efforts at attempting to predict the 1H were mostly focused on attempting to predict the outcome of 1H bars, in analogy to what I had implemented on successful daily systems on the EUR/USD. Clearly all this work proved to be fruitless since predicting the directionality of each 1H bar with any type of edge was an exercise in futility. My earlier attempts also attempted to use neural networks as machine learning algorithms which are quite slow and made each 1H test last for too long, something that prevented me from making any significant headway in this field. All of these approaches were wrong or heavily sub-optimal, all of which became apparent with the general lack of success within all this work.

Everything changed for me when I started to look at the results of DMB (data mining bias) research and the results from random walk hypothesis tests on the hourly time frames. These tests revealed that the 1H timeframes were most likely non-random on many instruments but this only became evident with lags >=25 bars. This indeed showed that you should not attempt to predict outcomes that are so short-sighted as the next 1H bar but that you could have some measure of significant success by attempting to predict a longer term outcome. The fact that autocorrelation lags are in the order of the daily volatility cycles also suggests that information from all hours is not useful for prediction, but that you should use data from certain hours in order to build the training sets for the machine learning algorithms.

2014-07-05_18-52-17

Additionally I also realized that a neural network algorithm was probably too heavy for the initial tests, so I decided to try with lighter machine learning algorithms that could be successful if the relationships in the 1H timeframe where linear. I therefore decided to start with a linear mapping algorithm which can carry out a 1H 25 year test within just a few seconds, while a neural network implementation can take days. It is also worth mentioning that the machine learning implementation retrains on each new bar using the past X input/output examples, meaning that the algorithm is constantly being retrained through the whole back-testing procedure.

The input/output structure is also critical for the success of the machine learning process. Since I wanted to look into longer periods I decided to implement something analogous to the input/output structure described within the post linked within the beginning of this article, which basically attempts to train the machine learning algorithm on the probability that a trade taken on each bar reaches a certain level of profit. In this manner your neural network is not trained against something that is only indirectly related with performance (like directionality) but it is trained with something that is linked directly to whether the trade will or will not achieve the desired level of success.

Using all the information derived from my new understanding of Forex price series I was therefore able to create a system using the Asirikuy F4 framework that achieves profitable historical results on the EUR/USD, USD/JPY and the USD/CHF. The system trades on the 1H time frame, constantly retrains its machine learning algorithm on each new 1H bar and uses trailing stop algorithms to minimize the giving back of profits. Overall I have to say that these initial results are very satisfactory and confirm the observations derived both from random walk hypothesis tests and the information obtained from the data mining analysis done using pKantu. With this I feel that I am starting to get a much clearer picture of where real market inefficiencies are located within the Forex market and I am therefore gaining the ability to exploit them within a wide variety of different techniques.

2014-07-05_18-53-07

Right now I am continuing to try additional modifications of this system to see if I can improve results. In particular I am trying other machine learning techniques, such as support vector machines, linear regressions, etc in order to see what predictive techniques might be best. If the phenomena end up having some degree of non linearity then an SVM might be able to yield a better result. As with my previous neural network experiments, the aim is also to build a more complex strategy using several different machine learning algorithms so that decisions can be taken between all of them to achieve a much greater accuracy. That said, I am very happy with these results as they represent a new hallmark of understanding for me within the FX market.

If you would like to learn more about machine learning based systems and how you can create your own using the F4 framework  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)

Print Friendly, PDF & Email
You can leave a response, or trackback from your own site.

6 Responses to “Building a Multi-currency Machine Learning Forex Strategy for the 1H Time frame”

  1. Fabio says:

    Hallo Daniel,
    congratulations: I think you are on the good road. And I am also a bit proud because I think that several of the things you write here basically come quite close to some of my past comments/ideas.

    Bye

    F

    • admin says:

      Hi Fabio,

      Thanks for commenting :o) Definitely, you have had some good insights that have helped me develop better trading implementations. Thanks for your contributions,

      Best Regards,

      Daniel

  2. Solento says:

    Hi Daniel,
    as always a pleasure to read. I am glad you finally stepped into serious 1H approaches, this seems much more reasonable to me than daily TF. However, i think you should soon investigate more complex, non rule based, non linear approaches (Random Forests, SVM with non linear kernels, NN etc.). I do very well understand the increase in complexity.. yet almost all of these approaches are parallelizable. Your “Crowdmining” community is a nice idea but why you dont get serious about this. Rent yourself a cluster or invest a few thousands in a GPU rack. If you dont want to use your own money, nothing comes cheaper than venture capital these days and if your approach is sound, people start throwing money at you anyways… let me know what you think :-)

    Greetings

    Solento

    • admin says:

      Hi Solento,

      Thanks a lot for posting :o) Definitely the use of non-linear machine learning algorithms is also within my to-do list, I will probably try support vector machines with non-linear kernels first, as this as probably the fastest (with the advantage that I have the code already implemented). I’ll post some of my results here once I have them.

      Regarding mining, sure, I am presently building a GPU mining rig to help us generate system results even faster (along with some other Asirikuy members), this will greatly enhance our chance to get better results. Regarding venture capital, that certainly sounds interesting, if you know anyone that would be willing to invest in such a venture do let me know. Thanks again for posting :o)

      Best Regards,

      Daniel

  3. SoftwarePerson says:

    Hi I sent this email to your hotmail but didn’t get a reply, so am sending as a comment: I’m interested in signing up for Asirikuy (am a C/C++ programmer) as a programming environment/library – am interested in an environment which is as “ready to go” as possible (has backtesting, optimization etc capabilities already integrated, rather than having to piece together different libraries etc)

    I would like to confirm its level of usability/get a glance at what (e.g. a
    list of the function names, example names etc in the library) is
    included. Is there any sort of introductory video, limited-time
    supervised guided tour/Q&A session or other way I could “take a glance”
    (beyond the summary already on the webpage and Mechanical Forex blog)
    prior to committing to the non-refundable annual fee? For example, is
    there a manual/list of install requirements I could look at?

    Also (ease of use question): to what extent is support available
    (email/skype) when first getting started?

    Thanks

    • admin says:

      Hi,

      Thanks for writing. I have not received any emails from you on my hotmail account, feel free to direct any emails to dfernandezp at unal.edu.co next time (less filtering on that email). Feel free to send me any questions you might have to this email and I’ll make sure I reply (note that I’ll be traveling today so I won’t be able to answer till the 17). Note that once you join I provide one-on-one support by email (24 hour max reply time) to any questions you might have about the software or its use. We have documentation generation through doxygen as well as a wiki and videos explaining how to use the framework for system building, back-testing, live trading, etc. Thanks again for writing,

      Best Regards,

      Daniel

Leave a Reply


Fatal error: Call to undefined function mcsp_html() in /home1/danielfp/public_html/mechanicalforex/wp-content/themes/modern-style/comments.php on line 71