Confused as to what price to use for backtesting?

Discussion in 'Strategy Development' started by wildshoe, Sep 9, 2011.

  1. wildshoe


    I'm backtesting using Thinkorswim strategies using the crossing of two of which is a weighted close...

    But how does the system know when they "actually" crossed, doesn't that mean that they won't cross until a bar after when the "close" has pulled the weighted close across?

    Couldn't it have been 3 bars after they actually "look crossed historically" ?

    And then what do I use, the open of the bar after the crossed? or two bars after they crossed? or the close of the bar they crossed? What is most realistic?

    I'm using Heiken-Ashi charts so I think that that is confusing me a bit, but I absolutely loathe regular charts...

    Also do you guys have any trade secrets to filter out small whipsaws?
  2. wildshoe


    I'm not yet willing to give the details on it. Let's just say it's two weighted moving averages, simple crossing strategy, that's it, no risk management or stop loss, no filtering, no oscillators, no nada.

    My problem is that I'm still not 100% sure if these results can be trusted. Is it possible that WHEN the moving averages have crossed, that 2, 3, 4 bars have already been printed. I assume that 1 bar AFTER the crossover has to print to bring the average across, but is it possible that with a weighted average it takes 2 or more bars to "bring the average across"? Such a hindrance would make this strategy meagerly profitable, albeit more realistic.

    Here are the details from thinkORswim's crappy backtesting system, using 2 contracts on the Russell 2000 mini futures over 180 days (the contract I obtained the most outsized returns from while backtesting)...equity curve for the Long strategy data at the bottom

  3. drm7


    I would do two things, just to start the verification process. Heiken-Ashi charts confuse me, so I can't tell you how to exactly verify your system.

    1. Does ThinkOrSwim have market replay? This may be tedious, but replay your system with Heiken-Ashi in one window, and a more conventional chart on another. Note the "actual" price when the moving averages on the H-A chart cross. Run through a couple of trades and see how things look.

    2. Run the backtest with the same moving averages, only on conventional candlesticks. If the results are REALLY different, then TOS may be "peeking".
  4. SMAs are lagging,i think that crossover point is takent as the price.You need to displace the SMAs,i guess, for the real trading.

    I`m trying to solve the same issue,but i only use one SMA(i use price-SMA crossover instead of SMA - SMA crossover),but i think now that TSF is more appropriate for this.
  5. Here you should add volume or some order flow indicator.
  6. jem


    wait to you watch moving averages real time on most charting software.
    If the trade goes you way the cross happens earlier than you entered.
    if the trades goes the other way the averages sometimes uncross.

    You will figure out that to make money you are going to have to have something more concrete to enter off of.

    Like... Moving average crossed on daily chart two days ago and now price pulled back to yesterdays closed... so buy at yesterdays close or go long after high of first hour is broken if before lunch.
  7. Samsara


    Precisely it.

    Wildshoe, you'll have to pay attention to the logic of your entry order. Are you using the open of the bar, or the next bar, when the cross occurs? You will end up with hindsight bias baked into your strategy as a result (which usually produces that kind of equity curve).
  8. it might be a process,but also might be a good idea to calculate the average delta in different market conditions and SMA slopes - the distance between the crossover point and the current price to use the data for the early 'frontrun' entries whet the price is still below the SMAs.Or just use the pullbacks to the SMAs,when it happened.
  9. what time is taken for the daily bar to begin?
  10. wildshoe


    so before I was using open and open because I thought it was taking the bar after the cross, but it was taking the bar OF the crosses

    my compromise has been to now use

    close of the bar that caused the cross on entry

    and the (O+C)/2 average of the bar that caused the cross on exit

    lost about 60k profit out of 100k

    so down to 40k return on 2 contracts of ES over 180 days....that sounds about right

    considering i have no other filtering or stoplosses...
    #10     Sep 10, 2011