Programming & Backtesting - Why do it?

The argument for programming and backtesting your trading idea is clear; you simply can't quantify the value of your method without it.
You can manually test, with calculator, pen and paper, but it is laborious and time-consuming. Human beings are also prone to errors and "wishful thinking".

 

If your idea is programmed mechanically, you can

  • Remove the emotions from testing.
  • Remove the mistakes from testing.
  • Easily optimise the parameter settings.
  • Test various hypotheses, such as larger profit targets, tighter stops, or trading mornings only.
  • Test on multiple markets.
  • Test on multiple time-frames.
Perhaps most importantly of all, you can develop a portfolio of profitable systems.
A system may be profitable, but it will still have drawdowns, and go through cycles when it doesn't work as well as other times. That's when having a number of different systems running at once can really help. If you have a properly diversified portfolio of systems, the systems won't be too similar to each other, such as all trend-following, or all trend-reversal. That means it is unlikely that all your systems will experience their worst drawdowns at the same time.
You can also get diversity from trading various markets that aren't too similar, such as equity futures, bonds and currencies. Rather than trade the ES, the TF and the YM all at once, which are likely to be in very similar conditions, you might trade the ES (e-mini S&P 500), the ZB (30 year T-bond) and the EUR/USD currency cross. It is more likely these will have non-correlated behaviours.

Backtesting A System

Backtest mechanical system profitHere is a four month backtest of an in-house system developed by TradingCoders.com that catches pullbacks in a trend. Out of the starting gate it is profitable, but certainly not flawless just yet.
It has a profit of $4,000, and a profit factor of 1.25.

What can we do to improve this system? Let's modify the criteria for entries, shooting for deeper pullbacks.

 

 

 

robot automatic trading equity

This equity graph certainly looks better. Our profit factor has gone up to 2.41, but the amount of trades got reduced by a factor of 5, and our profit is only $1,200.

Hopefully we can get more entries, and still keep our profitability.

 

 

 

 

 

EA strategy automated trading profitsAfter some more optimising, we can find that reducing our profit target actually increases the smoothness of our system. We can get our trade count up and our profitability up as well. Very low drawdowns too.
This results in a profit of $9,985 and a profit factor of 3.84, which is outstanding.

 

 

 

 

We may have a good idea about a trading method, but until it is tested it remains just an idea. We can't have any confidence that it will be profitable in the market. We can't risk real cash on a theory.
By building the idea as a mechanical system, we can hone and improve the idea until it demonstrates its worth.

Benefits of a Trading Portfolio

Trading multiple systems, or even the same system on different markets, can make a significant difference to the equity curve of your trading account.
With only one system on one market, such as you might manually trade on the e-minis or forex, you are susceptible to that specific market's conditions, and the results your one system gets out of those conditions.

 


portfolio testing PnL profit drawdown equity curve

Here is a backtest result of a system on one market.

So far so good, we are making money. But let's include a lot of other markets with the same system, without increasing the amount of contracts we trade at any one time.

 

 

 

 


rising trade profits mechanically automatically diversified

A huge improvement! About 3.5 times more profit.

Can it get better? Let's split our trading account into portions, dividing the account into quarters and trading one quarter of our money across four positions on four different markets at once.

 

 

 

 


backtest backtesting mechanical automatic strategy

Now we're talking! Very smooth, consistent equity curve, with very small drawdowns.

This is what a portfolio of systems, or a proven system across multiple markets can do for you.

 

 

 

 

 

This is why modelling your trading ideas mechanically is so important. Only with solid backtesting can you be confident your real-world trading results will be positive.

© TradingCoders.com 2009

I appreciate the free indicator TrendingTSF. If this is free I'm sure I will be amazed with the paid for indicators.

Andrew (U.S.A.) 

Free Stuff

Free indicators to download and use free, forever. Trading articles written by the TradingCoders team.

Check 'em out
Vote for a trading platform you want TradingCoders to support!
Chart tree grow trading profits

Our team is comprised of people who are both coders and traders. We combine programming skills with our knowledge of the markets to seek edge wherever it may be found. 

Our rates are low because we love what we do.
We will always deal with you with complete integrity, doing our very best to help you grow your trading.