How to backtest if you do not know how to code

Discussion in 'Trading' started by Iwilldoit, Jul 2, 2016.

Is it possible to backtest without knowing how to code

  1. Yes

    13 vote(s)
    65.0%
  2. No

    5 vote(s)
    25.0%
  3. I don't know

    2 vote(s)
    10.0%
  1. userque

    userque

    Well, that depends. It depends on the 'for whom?' question. And it depends on the 'what are you coding?' question.

    Right...above average. Most of those folks are already drawn to coding as a general principle.

    It depends upon how complex the underlying system is. If you're talking MA's, ok. But what about a machine learning system that randomly accesses historical data? [Or an Excel system that utilizes Excel Solver, etc.] Those are rhetorical questions. [I know the answers already.]
     
    #11     Jul 2, 2016
  2. lol so what I am asking is how do I backtest manually?

    please explain.

    @userque
     
    #12     Jul 2, 2016
  3. userque

    userque

    That depends a lot on your spreadsheet. When I did what you are trying to do:

    My data was organized as new bars first--near the top of the sheet. The sheet logic worked on the newest bar.

    In order to convert it for manual backtesting, I inserted a row above the latest bar. The data in this new row could 'point' to any other row. I used a spin button to change the row it pointed to. I modified the sheet to generate the signal based upon this 'variable' row instead of always on the 'top' row.

    To backtest, I would simply click the spin button to 'go back in time.'

    This is a very simplified account. But it presents the crux of what you need, based on I don't know anything about your sheet.
     
    #13     Jul 2, 2016


  4. @userque

    anyway you could PM me an example?
     
    #14     Jul 3, 2016
  5. userque

    userque

    I'll PM you.

    EDIT:

    Actually, I won't be revealing any secrets if that was the concern. :) I'll post here shortly.
     
    Last edited: Jul 3, 2016
    #15     Jul 3, 2016
  6. userque

    userque

    Hi, how is your system laid out?

    When it generates a signal, what row/data is it working on?

    Here is an example of what I was talking about:

    Original OHLC data:
    Code:
    01/30/99 1 2 3 4
    01/29/99 5 6 7 8
    01/28/99 9 0 1 2
    01/27/99 1 2 3 4
    01/26/99 5 6 7 8
    01/25/99 9 0 1 2
    
    Now suppose a system that uses the last three days of data. Here's how I would rearrange the data:

    Code:
    01/30/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/29/99 5 6 7 8 9 0 1 2 1 2 3 4
    01/28/99 9 0 1 2 1 2 3 4 5 6 7 8
    01/27/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/26/99 5 6 7 8 9 0 1 2
    01/25/99 9 0 1 2
    
    The last (oldest) two rows are ignored as they are incomplete. The sheet/system does its calculations on the top row only in order to generate a signal. So, how do we manually backtest this?

    Insert two new rows. In A1, type 2.
    In A2, enter:
    Code:
    =offset(a1,$a$1,0,1,1)
    Drag copy that so it is above every column that has data (=offset(b1,$a$1,0,1,1)...=offset(c1,$a$1,0,1,1)...etc.). Your data should look like this:
    Code:
    2
    01/30/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/30/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/29/99 5 6 7 8 9 0 1 2 1 2 3 4
    01/28/99 9 0 1 2 1 2 3 4 5 6 7 8
    01/27/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/26/99 5 6 7 8 9 0 1 2
    01/25/99 9 0 1 2
    
    Now, insure the sheet still does the calculations on the new top row. (Instead of inserting the rows initially, maybe sliding the values down via a copy-by-values would keep your formulas pointing to the 'new' row without modifications.)

    Now, change A1 to 3. You should then see this:
    Code:
    3
    01/29/99 5 6 7 8 9 0 1 2 1 2 3 4
    01/30/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/29/99 5 6 7 8 9 0 1 2 1 2 3 4
    01/28/99 9 0 1 2 1 2 3 4 5 6 7 8
    01/27/99 1 2 3 4 5 6 7 8 9 0 1 2
    01/26/99 5 6 7 8 9 0 1 2
    01/25/99 9 0 1 2
    
    Notice that the top row has changed. Your sheet should now be doing calculations on this 'new' data. You can add a spin button to make it easier/quicker to go back in time. You have to manually log the results of each calculation.

    But, you can make a macro to log the calculations for you. Then, you can decide to automate the whole process...at that point, you would have completed your simple backtesting system. You would have gone from manual to automated. But manual may be sufficient...depending upon how much testing you plan to do.
     
    #16     Jul 3, 2016
    Iwilldoit likes this.
  7. marsman

    marsman

    adventerous...
    I just don't understand why the OP still asks others if he can do it w/o any programming as he claims...
     
    #17     Jul 3, 2016
  8. Guys like me from the old generation still do it the old school way. We just go back over old charts and pick out 100, 200, 300 or more examples of the set up in question and count the number of times it worked out, failed, or allowed us to get out even. Based on those results we then know the probability. If it is high enough we will trade the set up and will know what to expect in 100 actual trades. Been doing this for 40 years. And one of the benefits of doing it this way is that you learn that much more about the set up by visual examination which you wouldn't get if a computer was doing it, and if the computer could really recognize the set up along with the context properly.
     
    Last edited: Jul 3, 2016
    #18     Jul 3, 2016
  9. I am asking how to manually backtest, since I do not know how to code

    @marsman
     
    #19     Jul 3, 2016
  10. That is essentially, what I do in excel:

    1. Look at the setup
    2. Record entry price in cell, see where price goes next on the chart, and then record the exit price (whether it may be stop or target order)
    3. Then there are formulas which calculate, the win ratio and net overall profit over a period of x trades.
    @learner2007 @userque @marsman
     
    #20     Jul 3, 2016
    SimpleMeLike likes this.