Saturday, September 29, 2012

Meta-Trader - Performance Based Lot Sizing

Welcome back, Meta-Traders.

Albert Einstein once said:  "The measure of intelligence is the ability to change". This quote really rings true since I'm more convinced than ever that the only way we are going to make any profits (and not end up giving them back) is to make systems which are adaptable to recent market conditions.

Case in point is the chart on the left which is a reconstructed equity graph of Atipaq Full Portfolio, which I have been tracking for nearly 2 years on the right side of the blog.  Note how the system started to rally right from the start and peaked (up nearly 100% from the start!) back in March of this year.  Since then, its been a straight slide downward and the system has now given back all of its gains and remains above positive only because of a deposit made back in March of 2012.

We know that the pair behind these losses - and behind much of the losses in my other portfolios -  has been the Atipaq USD/CHF instance.  Historically, this has been one on of the most profitable instances and is why I trade it in 3 of the 5 live accounts I'm tracking.  But up to now, I have been at a loss to explain what's behind the poor performance. Yesterday, Daniel Fernandez cleared it up in a post when he identified the problem as the year-long commitment from the Swiss Central Bank to prevent the EUR/CHF to fall below 1.20 level to stem runaway rally in the Swissie.  Since then, the pair has basically flat-lined, with the Swiss Central Bank coming  in with unlimited funds to prevent any meaningful breakdown of EUR/CHF below 1.20 level which has a related affect on USD/CHF and makes it behave more like EUR/USD.

This move has completely changed the dynamic in USD/CHF and caused a failure of our Atipaq USD/CHF instance.  But what can we do about it?  Its easy to see in retrospect what happened, but how can we guard against these type of changes in future systems?   I thought about it and came up with the idea of varying lot sizes based on recent performance of the systems.  Here's how it works:

  • Track the equity of the portfolio as a data series D
  • Calculate a 5-period moving average of portfolio equity as MA5
  • Calculate a 21-period moving average of portfolio equity as MA21
  • If D is greater than MA5, set M1=0.5, otherwise set M1=0.25
  • If MA5 is greater than MA21, set M2 = 0.5, otherwise set M2=0.25
  • Set M3 = M1 + M2
  • Multiple the baseline lot size (say 1%) times M3 to get your adjust lot size
  • Calculate the new equity portfolio as data series D1

At the end of this calculation, M3 will be a value between 0.5 and 1.  Multiply M3 times your normally expected lot size for the system.  I did a "thought experiment" using this system on a spreadsheet and came up with this adjusted equity graph:

The adjusted equity graph shows the following:

- Identical starting account size at $2100

- Peak valuation for the original series at $4396 versus  $4050 for the adjusted series

- Current valuation for the original series is $2297 versus $2736 for the adjusted series

Bottom line is that the adjusted series results in lower equity highs, but also lower draw down.

In this experiment, the lot size change was simulated in a spreadsheet outside of MT4.  In a true implementation, the logic would be inside the EA and would look back on the account equity and make the lot size adjustments on the fly.  Once that's done the return and draw down statistics can be compared "apples for apples" versus the spreadsheet method which is a construction.

Adjusting lot sized based on recent performance is just one potential method of making systems adaptive.  A more powerful idea would be a system which either buys or sells breakouts, depending on which method has worked recently.  A similar method would potentially have been able to adapt to the complete change in character of USD/CHF.

As always, more to come.  Have a great week.

No comments:

Post a Comment