Friday 19 March 2010

Backtesting Trading Ideas

Several readers have asked me to talk about how to backtest.

Firstly, I backtest an idea.

I see something happening over and over again in the market, and if I think it may be useful to watch and trade, I write down exactly what I want I saw. For example, order flow was positive as VB and smoothed CVD were green, both EMAs GREEN, and Price pulls back to 33EMA. This is the idea I that I want to test.

I then print out ten days of charts (I can't work from a screen - even my 24 inch ones) and look for that idea. I mark the charts every time I see it.

Once the chart is marked I write down the entry price in a column with a number corresponding to the mark on the chart and whether it is a LONG or a SHORT. I then go back to the chart and see whether my first logical scale point is reached or whether my drop dead stop would be hit. I take out the statisctics on those trades and look for a high win rate. How high? Over 60%. If I get that, then I'm in business. I then look at all the winning trades and all the losing trades to see what else I can do to filter out only losers. My aim is to get to at least 70% win rate.

I want to see at least 50 trades for this exercise so you may need more than 10 days of charts if the idea doesn't happen often enough and you're still interested.

Next, I concentrate on the winning trades. I look to see what each trade would have made using my exit rules.

I then gather the statistics adding back the losing trades. I now can decide whether I have something I can add to my trading setups.

The final step of this backtesting for me is to program it. Up until recently I used MultiCharts Easylanguage. Kiki helped me with this. However, with MarketDelta I have Volume Delta which is hugely important for me in seeing order flow. MultiCharts only gave me upticks and downticks. I look back on about a year of data and also forward walk it too.

This can all be done manually but using a computer for programming the backtests obviously makes it quicker.

P.S.
1. MarketDelta  has better than excellent customer service and they can help with backtesting for their system
2. If your question hasn't been answered or you don't see it posted, please email them again, I've managed to delete some comments accidentally.  This time I'll blame it on jet lag.

 Today's trades are for the Bund. You can see that there were only 50% winning trades but the day ended GREEN.

Click to enlarge

8 comments:

  1. Tom: I am curious how the context comes into play in your new setup testing. I realize that you can't readily get that variable into Easylanguage, and you have addressed this fact before, but in your initial testing is it a even a consideration? You didn't mention it.

    thanks, Rick

    ReplyDelete
  2. Hello Tom,
    this is something, that isn´t really clear to me, too.
    I understood that you backtest your setups without context and try to achieve the aquired winrate.
    What I do not really understand is, how you bring your tested setups in context, when you trade.
    For example, when you trade a pullback to EMA,
    to you consider EMA as S/R, or do you look for additional "context" in Market Profile.
    From my observation, when inside out setups occur around EMA, price has often already reversed from one of the Profilelevels and the trade is already some points/ticks away from the contextual MP levels.
    So my question is, what to you lean on, on such trades?

    Thanks and best wishes.

    ReplyDelete
  3. Tom, you don't feel the need to backtest beyond the last 50 occurences of a setup? Do you think going back further than that is a waste of time and if so why?
    I am asking only because I am about to backtest 3 years of data on a setup and am hoping you can talk me out of it. haha

    Regards, Cory

    ReplyDelete
  4. Tom,

    How do you read volume inside a bar? If you blow up a few bars and explain what you see, that would be very helpful.

    ReplyDelete
  5. Rick, context is hard to program and that's why I say that if you want to, you could use the FloBot to enter and then decide whether you wanted to stay in the trade. on the other hand, the results we're getting with the limited context programming tells me that perhaps its more profitable to be totally auto and cover more markets. We can program VAs and tails and where they are.
    Anon 10:13, VAH, VAL, POC and Tails.
    Cory, the 50 trades is only the first validation of the idea. We then go back 2 years but programmatically. This can be done manually but more painfully.
    Tickvix, When order flow and momentum is in line, I look at the proposed entry bar to see that the klast few ticks are strongly in my favour.

    ReplyDelete
  6. I have a technical question regarding the source of data for backtesting.

    I need tick data to view orderflow information for the trade setups, but my datafeed offers only 30 days of historical tick data.

    Do you know a reliable source where to purchase historical tick data so I can proceed with backtesting?

    Thank you.

    ReplyDelete
  7. Hello Tom,

    Could you explain the thinking behind Trade 2.

    Cummulative delta was still rising strongly as too was CCI and the entry was way above 33 EMA.

    I can only assume it was an "outside in" trade of some kind.

    Thanks for the blog
    Neil

    ReplyDelete
  8. Boris:

    try tickdata.com

    however, I don't know about bid/ask history. Also I recall some of the historic data vendors I looked into some time ago not having complete volume data.

    ReplyDelete