Announcement

Collapse
No announcement yet.

Backtesting - time travel?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Backtesting - time travel?

    I tried the example BackTesting Strategies and was surprised to find that I could achieve 90%+ win rate using btEMA.efs. Now I know this is impossible with a simple moving average so I looked at the trades. Guess what? When the price moves through the moving average line a signal is generated at the end of the bar in question. But the price recorded in the statistics for the trade is the OPENING price of the bar (ie a price from the past). Just how do you expect this to work?

    Am I misunderstanding something here, and do real-time signals work om the same basis (ie buy at the price as it was a while ago)?


  • #2
    I noticed this "future leak" as well. It wasn't as disappointing as discovering an arithmetic error in the profit / cumulative profit totals.

    I've yet to study the efs strategy code but it ought to be trivial to have the system buy at the close of the bar rather than the open. (That is, assuming the language is that robust in the very least)



    Comment


    • #3
      It is simple enough, just use Strategy.Close rather than Strategy.Market or, alternately, use Strategy.Market with Strategy.Nextbar.

      Garth
      Garth

      Comment

      Working...
      X