Backtest help

Discussion in 'Trading' started by Jgills, Oct 26, 2011.

  1. Jgills


    Hello all,

    I am very interested in learning how to "properly" (i put it in quotes because there is probably a multitude of ways) backtest strategies.

    Backtesting is a term I hear used often, and I understand what it means (testing your strategies based on historicals), but HOW do you perform your backtests? What programming language do you typically use? What program do you typically use?

    If I wanted to test moves off of what I perceive as support or resistance how can that be tested? These points cannot be easily quantifyable, but are clearly visable when looking at a chart.

    Any help on the topic of backtesting will be greatly appreciated.


  2. The easiest way to start is not cheap. As an example, the data provider E-Signal offers as part of their 129USD monthly fee the ability to straightforwardly code and test simple strategies such as you mentioned. It helps if you have some prior experience with programming, but if not, their code creation functionality can get you most of the way there. In addition you will need a subscription to the type of data you want to test, such as ES. What you will find is that you remember S/R working far more often than it actually does. But once you have developed the basic backtesting code structure and some skill at writing algorithms of P/V patterns, you have a powerful hypothesis testing engine capable of testing many hypotheses a day. My code is about 100 lines long because there are many conditions you must account for that are not immediately obvious when you start coding. Kindly let me know if you find a strategy that works. As a disclaimer, I pay E-Signal, they don't pay me. I loathe and detest their sorry-assed service, and have for more years than I care to admit. Bastards!
  3. Jgills


    Thanks for the response.

    I'll have to see if they offer a trial. I don't want to start paying for a subscription that I may not be able to use (because of my lack of programming knowledge).
  4. Give them a CC and they'll give you 30 days free base service. But you'll have to pay for real-time NYSE, NAZ, CME, or whatever for data. Your lack of programming knowledge can be overcome fairly quickly. But if you have never tried to take a time-based phenomenon and describe it algorithmically, that is a tougher issue. Backtesting is such a rathole that I think most people who consider it ultimately return to intuitive trading. Those S/R bounces are easy to see, right? Alternatively, there are maybe twenty posters here who are facile at E-Signal who will help if you do the heavy lifting. But you'll have to listen to us bitch, rant, rave, piss and moan about how much we hate E-Signal. And we're their loyal customer base.
  5. You can get a free 30 day trial of ninjatrader and code your strategies using pull down menus, like in a stock screener. It runs on free data you download from yahoo or google.

    After that it is 50 bux a month.
  6. N54_Fan


    I had the same dilemma when I first started. What worked for me may or may not work for you. I tend to be more of a rules based discretionary trader. By that I mean my system comes up with hundreds of trades a day but I filter them manually if they meet certain criteria. If you do automatic backtesting you will often see that what could be a profitable system for you is unprofitable simply because the computer program you used to simulate trades chose every single trade that met your criteria. We all know some trades look better than others and you also are not likely to have the capital to take every trade that your simulator may say it took. You have to cherry pick the best trades from your system.

    So what I did was I "forward backtested". I looked at historical data in a KNOWN uptrend like 3-2009 to 6-2011 and obvious known downtrend like 2007-2009, and finally a sideways market like 1994-1995. (I would look at other times as well but these are obvious choices.) Then I FORWARD PAPER TRADE FROM THERE. By that I mean I would start at the first day of the chosen timeframe and paper trade what I WOULD HAVE DONE in this environment. Now here you have to be honest with yourself as you know what type of market it is. So this way you have an idea if your system has an edge in these market types. Then, look at the trasition zones as the market changes from uptrend to sideways and then to downtrend and see if forward paper trading you would have picked up on the change. Finally, LIVE forward test your system on paper starting next week or something and see if you STILL have an edge.

    Best of all this "forward backtesting" is free!!

    IF you have made it this far in testing then you can trade REAL money. If you say "thats too much work"...then put down the computer and find something else to spend your time and money on as this "business" takes ALOT of work to be successfull.

    Good Luck
  7. eSignal has some ok backtesting capabilities, and you can develop strategies with their java-like language. Knowing how to code is fairly important, and the more years of experience you have, the better. Sometimes things that are easy to see are much harder to put into code, I've been doing that for a long time, and I can tell you that it should be done by a programmer with at least a year of experience. Otherwise you can use inbuilt indicators or modify existing ones. For example linear regression can give you a simple pseudo-trend-channel (if you're looking for Support/Resistance), but not a very reliable one. Also NinjaTrader has a better language which allows you to do more things with your strategies (and custom indicators within them).

    If you're reasonably good at coding, my advice would be to get some 4-5 years of data from a data-provider, put it into a custom chart format readable by your application, and code it from scratch. Having your own from scratch may seem like a huge task, but it will end up saving you time - especially if you want to create more complex strategies (and you always will because the first 50+ you make will be unprofitable or unreliable).
  8. Jgills


    Do you have any thoughts on how to code support and resistamce? I have data for the commodities/indicies/currencies dating back as far as bloomberg goes.

    A little more insight to my strategy: I'm not a day trader and im not trying to locate intraday s/r levels, i dont know if thay helps at all, but maybe it does. :)
  9. You talking position trading for days/weeks or investment for months/years?
  10. Jgills


    Poisition trading. Sorry for not clarifying.
    #10     Oct 26, 2011