View Full Version : Order triggering discrepency
rd_falcon
05-29-2008, 11:03 AM
Whenever I compare my real time strategy performance to the backtest results, my real time orders are triggering exactly 1 bar prior to when the back test is saying that it triggered. I can easily put a delay into the strategy so that they match up properly, but I want to see if there is a logical explination to this problem so that I can address it more effectively. Does anyone have any ideas on what might be causing this?
NinjaTrader_Ray
05-29-2008, 11:53 AM
First, you can't compare, see here - http://www.ninjatrader-support.com/HelpGuideV6/DiscrepanciesReal-TimeVsBacktest.html
Second, its possible you are running with the parameter "Calculate on bar close" set to false at run time which means signals can be triggered intrabar vs end of bar which is the case in a backtest.
rd_falcon
05-29-2008, 12:09 PM
The strategy is set to calculate on bar close, so that would work the same as the back test in that regard. The only reason that I mentioned comparing the two is that it seemed improbable for it to be just a coincidence that the real time trades were executing exactly 1 minute (on a 1 minute chart) prior to what the back test showed. I guess it is just a difference in when the data is being processed if I am understanding the link that you provided correctly.
NinjaTrader_Ray
05-29-2008, 12:52 PM
In a backtest, the executions are plotted on the bar after the signal is true, in real-time, the execution is plotted based on its actual time stamp. It is possible that it could be plotted on the signal bar or the next bar.
rd_falcon
05-29-2008, 01:20 PM
Ah, now that makes more sense. Now I just need to adjust my strategy to account for that. Thank you very much for your assistance.
rd_falcon
06-04-2008, 02:29 PM
I am having a new problem related to backtesting, so I thought I would put it in this same thread. This morning I ran a back test on a strategy and got a set of results for the last couple of days. I then disconnected from my live account and ran a market replay for yesterday through this morning. After that was done and I reconnected to my live account, the results of the back test was very different from the first one that I ran.
I have tried resetting the database to try and get it reset so that the backtest showed the original results, but that didn't work. Do you have any ideas what may have caused the replay to change my backtest results?
NinjaTrader_Ray
06-04-2008, 02:47 PM
Replay is considered real-time, with that in mind, please look at the following link - http://www.ninjatrader-support.com/HelpGuideV6/DiscrepanciesReal-TimeVsBacktest.html
rd_falcon
06-04-2008, 02:51 PM
Well the replay results were fine. Maybe I didn't explain my question well enough. Prior to running the replay, the backtest in the strategy analyzer returned one set of results. After the replay, the strategy analyzer returned a different set of results for the same time period with the same parameters set.
NinjaTrader_Ray
06-04-2008, 03:24 PM
Got it, thanks.
Something then must have changed, settings, strategy logic, underlying data. Not sure what, but something would have changed for sure.
rd_falcon
06-04-2008, 03:29 PM
Alright, I will just keep my eye on it and see if it happens again. That was the first time I have had it happen, so we will see if it was just a random glitch in the data set. Thanks for your help.
rd_falcon
06-04-2008, 09:14 PM
Alright, I did some more investigating in my historical data database and I have found the answer to my problem. I exported the database, deleted it from the program, and then tried importing it again, but it gave me an error saying that a line wasn't formated correctly. Last week I got my account transfered to running on sub-pip with Gain capital. From that day on, Ninja Trader has been storing the historical data as 0.0000'0, which is how the price appears in the program. If I manually go into the text file and delete the ' the data will then import without a problem.
This explains the problem that I described earlier because I was originially feeding the analyzer with data from that session, but whenever I disconnected, and reconnected, the program then had to load the historical data from the database, which Ninja Trader was not able to accurately read every price, only the even pricing with no sub-pips.
I hope I have explained this situation adequately to where you understand it. Hopefully you will be able to address this problem in the next update of Ninja Trader so that it properly handles sub-pip entries in the database. If you need any further explination, please let me know and I will be more than happy to provide the information.
NinjaTrader_Dierk
06-05-2008, 01:19 AM
Thanks for reporting. This will be fixed with next update.
rd_falcon
06-05-2008, 02:01 PM
Awsome, I will be looking forward to that update.