learning to backtest

Discussion in 'Strategy Development' started by mags29464, Dec 4, 2012.

  1. I've never backtested before. I've analyzed data (things like correlations, ratios, etc) but never backtested. Is there anything like an tutorial or a book that gives some examples of backtesting strategies. I want to learn to backtest using excel. any help would be appreciated...
  2. Jgills


    i'm not sure of any books on the subject.

    from my perspective, a good way to start would be to test simple strategies. an example of one could be, buy underlyer if it crosses above the 10,20,30,40,50D (you set however many days) moving average. then set some additional rules u want to see, like ok if i buy then hold it for 3 days, or hold it for a month, or hold it until x amount of pnl, or until a stop-loss trigger is hit. you will find there are many little additional pieces of logic you can add.

    that is just a simple one to get you used to testing stuff in excel. after that you can think of some of your own, or find some papers and try to replicate their results, a place like ssrn (social science research network (i think)) has lots of papers.

    hope this helps at all
  3. What I'm kind of asking is how the process works or how its setup. I know it must be more difficult a process than can posted in a single post but an general overview would be appreciated.
  4. Jgills


    well then first figure out what you want to test.. for example lets say you want to test a simple strategy of buying spx every monday (and lets just assume you're using a weekly paycheck and its the same amount of money every week, call it $1000, and you're buying SPY)

    if you like to seperate everything out you can do it in different columns. the columns will be:

    SPY prices
    A column of logic, i.e. is today monday? this can be done with the function =weekday(date,2) or something like that and if so then give you spy levels.
    another column of $1000/spy level on mondays rounded down so you know how many shares you're buying

    then with all that you can figure out how many shares of spy you own at what average price and see if that strategy would have been profitable from whatever ur start date is until now. this is a pretty naive approach and has no thesis to it, it was simply to try to help you figure out how to put a sheet together. if this isn't too helpful let me know.
  5. ================
    Good ,accurate example; they use 200 day moving averages also.:cool:
  6. ok I see what you mean. I guess I just need to learn the excel syntax because I have no idea how to tell it to check dates or days of the week.
    Imma have to look into it a lot more.

  7. Try ninjatraders backtest and optimization engines
    They are free and easy to set up and use
    They won't help you prove out a real trading strategy, but they can show you the limitations of backtest engines