Improving position sizing

 

Hey everyone, we wrote a short post on how to improve your position sizing. This uses R but is easily applicable to your MT4 strategy or EA.

TRAIDE_ML_Header

Position sizing is an important, often overlooked aspect of trading. Many traders look at position sizing as a way to decrease downside risk without seeing it as a tool to increase performance.


Let's see how we can more intelligently determine our position size using a random forest algorithm. We'll assume you already have a strategy (<Deleted>). If you are looking for a new strategy, you can quickly build one in <Deleted>and copy the trades from the trade table on the Dashboard to a csv. Just make sure you use the same format as the csv above.

Defining Winning and Losing Trades

While it is important not to risk too much of your total account on each trade (usually around 2%), there are far better ways than just using a fixed lot, or fixed percentage, position size for each trade.

One logical train of thought would be to enter a larger position when your trade has a higher probability of success and a smaller position when you are less sure about the trade. Using a random forest, a popular machine-learning algorithm, we can estimate the probability of success for each trade and size accordingly (never risking more than 2% per trade of course).

I went into greater detail on using a <Deleted> for the GBP/USD and we can use a similar approach to help us determine the optimal position size.

Given my data set of historical trades (<Deleted>, first we classify each trade into three categories based on its return:


Winning trades
    • Returns >= 10 pips
    • Ideally we want to enter into larger positions for these trades
Neutral trades
    • Returns < 10 pips and Returns >= -10 pips
    • We can use this as our default position size

Losing trades

  • Returns < -10 pips
  • We want to enter into smaller positions for these trades

Building Our Model
Next we have to decide what information we want to use to make our decision, otherwise known as the inputs to the model. This is an area where you should use your experience with your own strategy to make a decision. A couple different options:

Current market conditions
  • Inputs: Volatility, trending or sideways market, etc.
  • This is appropriate if your strategy tends to perform well in certain market conditions

Recent performance

  • Inputs: the returns of the last “n” trades
  • If you notice your strategy goes through periods when it performs well and periods when it underperforms, this is probably the way you want to go.

External factors

  • Inputs: major news announcements, holidays, Mondays/Fridays, etc.
  • While some traders will avoid trading around these “external factors”, testing to see if this is justified is usually a good idea.


Let’s try using the returns of the last 3 trades to determine the position size of our next trade (<Deleted>. We will double our position size if the model predicts the next trade will be a “Winning trade” (defined as a return over 10 pips) and cut it in half if it predicts a “Losing trade” (a return of less than -10 pips) and keep the default position size for all “Neutral trades” (returns less than 10 pips but greater than -10 pips). We train the model on the first two thirds of the data set (our historical trades) and then test it on the final third of the trades, our out-of-sample test:


Wow! We were able to get a 20% increase in total return and increase our return per trade from 2.8 pips to over 3.3 pips just by using this fairly basic model. Not bad at all!

Machine learning algorithms and techniques can be a powerful weapon in your arsenal when looking to improve the performance of your strategy. This is just one of the ways at<Deleted> where we use these techniques to improve your strategy.
Reason: