Machine Learning in FX: Going after a large scale implementation to imitate a trader’s brain

There are many ways to build successful machine learning algorithms to trade the Forex market. In the past I  have used neural networks, linear maps, linear regressions, support vector machines and random forests to obtain profitable results for different FX symbols but the main thing that all my approaches have had in common is the fact that they are mostly independent and limited in scope to improving and changing as time goes by. The way in which I have been building machine learning algorithms makes their input structure mostly “fixed in place” and algorithm parameters constant as a function of time, therefore preventing the evolution of the algorithms outside of their initial modeling scope and forcing me to adapt a stance at machine learning systems that is very similar to the one I take for data-mined systems (measure mining bias, discard according to worst case scenarios, etc).

 

brain1

 

This way of looking at machine learning is common to many traders I work with and can be used successfully (for example you can read a thread where a fellow trader – AlgoTraderJo – has been posting his research on the subject at ForexFactory using tools from our community) but I believe that a different and potentially better approach can be made. Today I want to share with you some of my thoughts around machine learning and how I have fully reevaluated the way in which I approach the subject. We will talk about how this potentially improves the quest for a better ML approach in order to to reach a state similar to what a “profitable trader’s brain” would optimally do. I will go through the main aspects of the architecture I propose and how this structure leads to a decision making process that can be compared to that of a human trader.

I believe that to build a truly amazing machine learning approach to trading we must first answer a few basic questions. What abilities make human brain decisions different than those made by a computer system in trading? What characteristics does a computer system need to have in order to be able to rival the ability a successful human has to trade? How does a human adapt to changes in trading? What can we do to achieve these abilities? What can we do to be even better at them?

Selection_086

As I see it the human brain’s main power is the ability to achieve a large degree of adaptability to changes in information. The ability to learn from mistakes and successes and make changes to improve the decision making process according to a desired outcome. A human brain can consider many different decisions at the same time and reach a conclusion that accounts for previous experience and currently available data. In that way a human also learns from any new inputs and considers that as well when making the next decision. Through this analysis any machine learning approach that seeks to rival the pinnacle of human ability in trading must be able to achieve two main things: learn from experience and consider multiple decision pathways.

Such a machine learning approach must also learn in a manner similar to how a human learns, it must learn from its own experience and make changes as new experiences are added. If it did something that did not work in the past then it must be less likely to do it in the future in the same way that if it did something successfully the probability to repeat it should increase. But how do we achieve all these desired characteristics?

I think this can be done in practice by using a combination of machine learning models focused on predicting maximum excursion values at different time horizons and models focused on interpreting this information. When a new bar comes in our machine learning models draw predictions for the maximum long and short excursions at different time horizons. This information is then used by a “trade profile builder” which has its own set of models that use trade profit/loss predictions to also gauge what the best approaches for trade construction might be (what SL/TP targets to use, what lot sizing, etc). After a trade finishes all trade constructor models are updated with all real trade profile information (what SL and TP values would have given what profit with those excursion predictions, etc) and all real predictor values for that bar are also updated. Using the real and predicted values for excursions we can also build model scores that can be used to evaluate model quality. In this way models below a certain score can also be discarded, as we deem their predictions to no longer be within the desired level of accuracy.

Selection_087

In analogy since we have a database containing all bar inputs and excursion values we can in parallel also construct an assortment of new models using random combinations of inputs, ML algorithms and model parameters to see if they are worth adding to the database in the construction of new predictions. Models would be evaluated in the same manner as models within the database are. This means that  models are constantly retrained before testing for each new prediction within the DB instead of training over the whole set and then evaluating prediction accuracy (which opens up the way to much worse data mining bias). If a model score in the end is high enough then it is considered viable and added to the trading system so that the profiling models can use this information for trading. In analogy we can do the same thing for the construction of trade profiling models.

Selection_089

 

In this way you have a trading system that behaves in a very complex manner. You have a constant testing and addition of new models based on historical data, you have a constant evaluation of new models that come into play and you have a trade profile construction module that is subject to the same process. In essence I believe that this has the potential to behave in a manner similar to how a successful trader’s brain optimally would behave like. The overall system is able to change the models it uses for price prediction and trade construction as new data becomes available. What you have here is a set of models that function as non-lagging indicators for future price action “the trading models” and another set of models that essentially function as trading systems, telling us where to trade and what information to use for actual trading, “the profile building models”.

The above implementation requires an approach from zero using extensive databases and new approaches for machine learning, so it is not an easy task. Could such an approach be successful? We’ll find out when I finish the above implementation :o)

If you would like to learn more about the construction of algorithmic systems and how we have developed machine learning strategies at Asirikuy please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading.

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

3 Responses to “Machine Learning in FX: Going after a large scale implementation to imitate a trader’s brain”

  1. Jan says:

    I think similar results we can accomplish by simple brutal force optimization and looking on the island of results. Only certain computational power is required.

  2. Joerg says:

    Hello Daniel,

    You are assembling a lot of know-how in order to build efficient EAs. May you be ever so successful with it!
    And you are discussing a lot of thinking issues of traders in your free ebook. That’s a great job well done! Thank you for it.

    Many years ago I came across a book on Neural Networks and its application in trading. The author, a PhD at Lehman Bro. made fantastic claims in it. So I contacted him. And I talked to the bank he had quoted. And they both confirmed the great results.
    Since Lehman Bro. no longer exists, I am glad you are not restricting your research to NN only – although the field is large – but also looking at other promising methods.

    Also, numerous years ago, I read about an international competition of electricity load forecast, with many colleges participating. The winner was a researcher on SVM from China.
    And I saw, you are looking at SVM, so that looks promising to me too.

    When I read your free ebook, I was pleased to read how you discard martingale and other high risk trades. This article and many others are real eye openers. Thank you very much for making this important information freely available! It is sound advice to keep investors from getting burnt
    Also, I didn’t miss your essay on drawdowns. Would you permit a thought on that?
    I was wondering, what would happen, if the trading robot actually had two identical trading machines. One that does the actual trading, the other to simulate the exact same trades while focusing on the trader’s capital balance. Then, when a large drawdown is obvious, this second trading machine, a kind of supervisor, it does two things:
    One, it tells the real trading machine to take (the capital) to the security exit and then to stop trading.
    Two, it will keep continuing the trading strategy without executing actual trades, and when the drawdown period is over, that many months in the future, it will kick in the capital and have the actual trading engine do the trading again.

    If you don’t want to get burned, you will do what it takes. If a trading robot doesn’t know, how to protect the trader, then it will simply need to know what it takes and do it. Since, it’s man made, man can decide to make it to his benefit. And if I read correctly in your ebook, more capital in the trader’s account gives him more trading options.
    Another, perhaps a little more demanding job for the supervisor part of the robot would be, to look for winning strategies (possibly in a repository) in what it presently sees as a drawdown market and after finding some and picking the very best, make the robot trade these.
    I figure, if the drawdown lasts for many months, there is a lot of time the computer could use to find and evaluate winning strategies. Not so?

    It appears to me, that you have everything in place to build this kind of EA very quickly and see (possibly confirm) whether it does any good to a trader’s long term balance, your own included.
    Would you consider doing it?

    It is a pleasure seeing you being so involved and competent in your field.
    May you be ever so successful!

    Kind regards

    Joerg

  3. Joaquín says:

    I think that Joerg’s idea is very interesting.

    The technique would be detecting a major drawdown when it is beginning, (for example when it reaches the average drawdown plus one standard deviation)and then stop trading but not stop simulating, in order to resume trading when the simulation detects that the drawdown is changing its direction. Don’t need to wait until drawdown has ended completely.

    I am reading your e-book, too. It’s date is August-2010.

    May you release a 2010-2015 update, Daniel?

    Thank you very much.

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