Thursday, 8 September 2011

Backtesting and Walking Forward

The process I use for backtesting is different depending upon whether I want to use the algo for fully automated trading or for Hybrid Trading, where I will manage the exits.

I do this because I am looking for different things in the backtesting.

Before I start looking at each type of optimisation, I run a full optimisation testing all the main inputs in order to validate the model.

For a fully automated strategy, I want to see the most money made, but I need to qualify this with a number of prerequisites, including in no particular order:
  • Average Trade Size big enough
  • Maximum Drawdown small enough
  • Win Rate high enough
  • Outliers should have minimal or no impact on results
  • Walk forward analysis pass  
Walk forward analysis  is important in order to have the best possible robustness of the algo.

For a Hybrid Trading backtest they include:
  • Win Rate (most important)
  • Stop Loss levels
My main required metric is a high win rate, as the true profitability in using the algo will depend upon how well I manage the trades.

The process of building the algo and testing it is quite a complex one. As I have said before, I first was involved in the process in the mid 1980's and learned how to create algos successfully by trial and error. There was a lot of error. I discarded auto trading a number of times over the years as the technology just wasn't there to do it successfully. Teaching Kiki to trade was responsible for me getting back into auto trading once again in 2009.

The way that the data is used in the process and the way that an algo is created based upon sound trading principles not math and squiggly lines has proven to be the key to successful algo building. There are numerous biases that need to be taken into account, not the least of which is that position bias that has resulted from the way that the data trends. Building the algo requires the elimination or the accommodation of the type of market activity that is revealed in the historical data.

It is because of this complexity and because of the difficulties that I have seen  very smart traders have had with the process that I decided to do the workshop in November.

The technology available to us, retail traders, has reached the level required for doing this successfully. We can't easily, if at all, trade many times a minute but that is NOT my aim. The aim and the arbiter of success is profits in my trading accounts. No number of successful computer runs mean anything. It's the making of real money in real time that counts. Of course I test in a SIM account because I know that if I'm not profitable in SIM then I can't be profitable with real money.

The November Workshop will break down my principal trading pictures into their components so everyone has a full understanding of how and why they work so well. We will then put the components together into trading logic for a computer.

Whether you want to use the algos for just signals and alerts, or hybrid trading  where the algo takes care of the instant trade recognition and instant trade execution and you manage the trade, or you want to fully automate your trading, this workshop can provide you with the tools you need to be self sufficient.

One more day in Budapest and back to France on Saturday. It's been great here. Last night we went to the world premiere of a 3D production of the opera, Bluebeard, written by Bela Bartok. I really liked the opera and using 3D projection of the scenery was very novel.


  1. EL: Great post.

    Note the Walk forward analysis link gives an error 404 message trying to go to the TradeStation site's page.

  2. Hi EL,

    When you backtest with Tradestation or Multicharts do you require that price "ticks through" your limit price to guarantee a filled order?

  3. Anon 22:41, Definitely. Backtesting is an art in itself. There are more issues than I can talk about here. To get a meaningful algo with meaningful backtest results that will result in the robustness required for live trading needs a lot of thought. It's not until I had many, many algos that tested well and failed live that I began to understand what was required.