Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Sim to Real
Collapse
X
-
Hi occam,
There's not one cause that springs to mind. Strategies should function similarly when applied to sim account or live account. CalculateOnBarClose determines whether conditions are evaluated on tick by tick basis or on bar close.
The bar closing event and the next bar open are the same event so maybe you're seeing an issue with how your execution is plotted? Please review the link below on this:
In order to evaluate strategy behavior on either sim or live account, you need debugging tools like TraceOrders output and print statements.
Ryan M.NinjaTrader Customer Service
-
I asked occam to aid me in developing a code that will result in a closer approximation in the backtest with a sim chart. If the profit target and stop loss occur in the same bar the stop loss takes precedence over the profit target even though the profit target may be hit before the stop loss. Using tick data helps with this problem but you can still get a stop loss even though the profit target is hit first. Is there a way for the backtest to be delayed so that it always enters at the beginning of the next bar? I feel this may help to some extent with this problem.Originally posted by NinjaTrader_RyanM View PostI'm sorry - I don't follow your last reply. Can you please clarify or provide a code snippet along with what you expect to happen with it?
Thanks
Jerry
Comment
-
Hi Jerry,
In a backtest, orders are submitted on the bar after the condition evaluates to true. This is not configurable.
This sample can help you achieve intrabar granularity in a backtest:
You have to move away from the Set statements, and use for example ExitLongLimit() and ExitStopLimit() for your stop loss and target orders.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
94 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
49 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
31 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
34 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
71 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment