Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Live trading lags backtest by 1 bar
Collapse
X
-
Live trading lags backtest by 1 bar
Attached is a screenshot of the chart with a strategy running on it. Between live and backtest, it report taking trades at the same time (same timestamp between live execution and backtest reported trade), however, on the chart it shows the backtest executing 1 bar earlier - why is this?Tags: None
-
Hello samish18,
From the image I cant tell which trade you are referring to as one image excludes the bar time stamps.
That may be an expected difference, generally you will see some differences between realtime and backtest. To confirm the logic happened exactly the same between the tests you can add prints to debug that use case. We have a guide that goes over that here:
-
I attached the execution from the live trades and the backtest results - this is a terrible discrepancy, but some level of erroneous results is returned with every backtest and every strategy. NInjatrader is used for its ability to operate automated strategies - please fix this aspect of the product
Comment
-
Hello samish18,
From only the executions I wouldn't be able to tell what happened different, that would require debugging the strategy as described in the link I provided. There are expected differences between historical testing and realtime testing so there will most likely be some discrepancies between tests. For a backtest to exactly match realtime every aspect of the test must be exactly identical so the strategy calculates the same and produces the same executions. To know its working identically would require adding debugging to the script.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
33 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment