Machine learning presents many unique and compelling advantages for traders looking for an edge in the market. Just in the last year we have seen a huge amount of resources from the world’s top hedge funds, like Bridgewater Associates, dedicated to exploring these techniques.
While using machine learning or artificial intelligence seems incredibly complex and difficult to implement, there are still ways to leverage their capabilities without needing a PhD in math or science.
この記事で, we’ll go through 3 different ways that you can use techniques from machine learning to improve your own trading.
One of the most important decisions is deciding on which indicators to use to trade. Whether you are a technical or fundamental trader, or you just use price action to trade, your success is going to be largely dependent on the indicators that you use and how you interpret them.
幸いにも, there are many different methods for selecting your indicators and this is known as “feature selection” in the machine-learning world.
Using a Decision Tree to Select Your Indicators
Decision trees are very versatile algorithms that have the benefit of being easily interpretable. Given a large dataset of indicators and the price movement of the asset, a decision tree will find the indicators, and indicator values, that best split the data between price increases and price decreases. Indicators closer to the top of the tree are seen as better predictors than those closer to the bottom of the tree, and following a particular branch will allow you to easily find interdependencies and relationships between the indicators.
The decision tree will also give you a set of rules that you can use to trade based on those indicators, but you must be sure to properly prune the tree and test for overfitting.
The decision tree is a powerful, visual tool that can help you decide which combinations of indicators to trade and at what values to trade them. You can find a tutorial on how to build a strategy with a decision tree ここで or for a more general guide, in R ここで is a good resource.
Once you have the basis for your strategy, the next step is optimization, or choosing the correct parameter values to maximize your chance of success. Many strategies have a wide variety of parameters, such as indicator settings, the entry and exit conditions, stop loss and take profit levels, and position sizing, that make “brute force” methods of trying every single combination extremely difficult and time consuming, if at all even possible.
Solving these types of problems is another area where machine learning excels.
Optimizing a Strategy Using Genetic Algorithms
Genetic algorithms mimic the process of natural selection by creating a unique set of “child” strategies that contains a mixture of the best “parent’” strategies, with a chance of random mutation.
The process begins by encoding your strategy into an array. For example it could read as something like:
|インジケーター 1 期間||インジケーター 2 期間||Buy Condition||Sell Condition||リスク:Reward Ratio|
Where a 50 – 200 period moving average cross, とともに 50 pip to 100 pip risk-to-reward ratio would be:
|50 – period Moving Average||100 – period Moving Average||インジケーター 1 crosses above Indicator 2||インジケーター 1 crosses below Indicator 2||50:100|
You would then generate a large population of strategies with random variations of these parameters. These strategies all have different combinations of moving average periods, entry and exit conditions, and risk-to-reward ratios.
次, you would test this population by running each strategy over a test set and selecting the top strategies based on a performance metric of your choice.
最後に, you randomly combine the traits of the top strategies, with a small chance of “mutating” some of the parameters, to create a new generation of “child” strategies. You then repeat the evaluation procedure and once again mate the top performing strategies from this new generation. This leads to a survival of fittest scenario where only the top strategies “survive” to pass along their genes to the next generation
Repeat this process a large number of times or until a certain performance criteria is reached and you are left with a very robust strategy built from generations of the best performing strategies!
You do have to make sure that you select an appropriate performance metric (such as risk-adjusted return) and always test the final strategy over data that wasn’t used to build the strategy to ensure that you aren’t overfitting to a particular data set.
This is a very powerful and robust method that has been successful in a wide variety of applications, including the world of trading. You can find a more detailed description ここで and a tutorial on how to implement it in R ここで.
One of the more attractive aspects of machine learning is having an algorithm that is able to learn and adapt to changing market conditions. しかし, this creates a “blackbox” strategy that, if you do not completely understand how the algorithms work and thoroughly tested it yourself, is very difficult to trust on a live account. Not knowing when or why a strategy is entering a trade can be a scary proposition.
しかし, there are ways to get the benefits of an intelligent, algorithmic approach while still maintaining transparency and understanding in your strategy.
Association Rule Learning
Association Rule Learning is the process of deriving a set of clear, understandable rules from the patterns uncovered by a machine-learning algorithm.
Algorithms, like the Apriori algorithm, search a dataset of indicators, indicator values, and the resulting price movement to produce a set of conditions; basically “if-then” statements, that lead to the highest-performing results. しかし, it’s still difficult to know exactly where these rules are coming from, the Apriori algorithm requires a fairly large number of parameters to be tuned and this process does not lend itself well to changing market conditions.
と TRAIDE, we took the process one step further and allow you to see the patterns found by an ensemble of machine-learning algorithms, from which you can create your own trading rules. These rules are then easy to implement and adjusted to changing market conditions, all without requiring any programming or mathematical experience. You are able to get the benefits of using machine-learning algorithms to trade while still maintaining complete transparency, an understanding of your strategy, and including your own domain expertise in your trading.
Using machine learning and artificial intelligence to find an edge in the market does not need to be exclusively owned by only the largest financial institutions. As this technology becomes more accessible and these techniques more common, you too can use machine learning to improve your trading.