Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not moving to realtime state

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?​Click image for larger version

Name:	image.png
Views:	121
Size:	28.7 KB
ID:	1333219
    Click image for larger version

Name:	image.png
Views:	111
Size:	2.0 KB
ID:	1333220​​

    #2
    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

    Comment


      #3
      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


        #4
        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


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          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?
          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 again

          Comment


            #6
            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


              #7
              Click image for larger version

Name:	image.png
Views:	99
Size:	19.6 KB
ID:	1333556

              This is what i mean, they are phantom entries/exits at points that never were hit​

              Comment


                #8
                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 argusthome, 03-08-2026, 10:06 AM
                0 responses
                113 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                60 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                39 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                43 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                80 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X