PDA

View Full Version : live (sim) versus backtest


ceesvh
07-04-2007, 04:52 AM
Yesterday I had a strategy running in sim the whole day on different instruments, using live IB as datafeed. The executions were recorded and at the end of the day they were saved in a file. The reason is that I wanted to compare today these executions with the executions in the backtest including yesterday.

That is what I did this morning but I made another observation.
Some trades executed yesterday in sim on live data in real time were not the same as the trades in the backtest.
The results are the following

Number of trades
Dax........... sim 7 backtest 5
Euro(6E)..... sim 5 backtest 3
ER2............ sim 2 backtest 1
NQ............. sim 2 backtest 4
GBL.............sim 2 backtest 0
All trades were executed at bar close.

Does anybody have the same experience- also live trades versus backtest- or can offer an explanation fot this phenomenon.

NinjaTrader_Ray
07-04-2007, 09:42 AM
This comparing apples to oranges for many reasons -

- Bars built from real-time data may be different than historical data loaded from IB's servers (or any other server for that matter)
- Limit orders execute differently in real-time than in backtest
- Backtest always run CalculateOnBarClose == true even if set false in which it runs tick by tick in real-time

NinjaTrader_Ray
07-04-2007, 10:55 AM
We have so much documentation even I sometimes forget what we have...

Here is a more detailed explanation.

http://www.ninjatrader-support.com/HelpGuideV6/DiscrepanciesReal-TimeVsBacktest.html

ceesvh
07-04-2007, 12:56 PM
Ray,
Thanks for the fast answer.
I had my computer running all day yesterday, and this pricedata is stored at my computer. So I suppose that the pricedata for the backtest is the same.

I do not use limitorders, just marketorders.

The question is : how can I get as near as possible to reality testing a strategy.

NinjaTrader_Ray
07-04-2007, 01:18 PM
Your question is a one which has been debated for years!