Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy not moving to realtime state
Collapse
X
-
Strategy not moving to realtime state
I have a strategy that for the past few months i ran in backtests, market replay and then finally "live" simulated. Everything has been working up until today. Essentially I will load up the strategy, it will move through all the historical data, and right before it is supposed to set to realtime, I get the expected message 'Enabling NinjaScript Strategy' but then everything just freezes and the program crashes. The same thing happens now when i load it in the backtester. The backtester will load the historical data and then crash. What is going on here?
Tags: None
-
Hello esanders251206,
If the strategy is becoming disabled or the platform application is crashing with a full shutdown, this would suggest improper code in the script.
To confirm, the behavior does not occur with the SampleMACrossover included with NinjaTrader?
Comment out all assignments, method calls, and branching commands in OnStateChange() and OnBarUpdate(), comment out all private and public variables in the scope of the class.
Compile and re-run the script.
Does the same behavior occur?Chelsea B.NinjaTrader Customer Service
-
It does not do this with the MA crossover strategy. But i'm very confused then because it was working, i restarted the application, and then it got stuck. I changed absolutely no code from its working state.
Comment
-
Hello esanders251206,
Comment out all assignments, method calls, and branching commands in OnStateChange() and OnBarUpdate() (so no logic is running).
Run the script and confirm if the script still freezes.
If it does not, uncomment each commented out line one by one until the behavior returns.
What is the last line uncommented when the behavior returns?Chelsea B.NinjaTrader Customer Service
Comment
-
I just restarted the application again without changing anything and now it's running. While that's a good thing, it still doesn't erase my question of what is going on, because while it might be the code, I can't test what "fixes" it or not now that it's working againOriginally posted by NinjaTrader_ChelseaB View PostHello esanders251206,
Comment out all assignments, method calls, and branching commands in OnStateChange() and OnBarUpdate() (so no logic is running).
Run the script and confirm if the script still freezes.
If it does not, uncomment each commented out line one by one until the behavior returns.
What is the last line uncommented when the behavior returns?
Comment
-
The strategy itself also has some very odd behavior, the markers for take profit/stop loss used to be on the candle, and now they're like 50 points above the candle, I have lines which are the only points it ever enters and it's entering in the middle, the labels move so every entry is stacked on one candle, it's really weird behavior. That part isn't my code, that's the software.
Comment
-
-
Hello esanders251206,
The freezing could be due to an endless loop, a run-time error, or a connection loss.
The orders outside of the bar could be due to an out of sync pc clock, a bar type that does not show the full market movement, or missing data (which can be caused by a connection loss).
More testing would be necessary to determine the issue.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 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