Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I need to constantly Disable and Enable my strategy to keep it running!

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

    I need to constantly Disable and Enable my strategy to keep it running!

    Hi everyone, I am writing a strategy that checks some conditions and then places an order if we meet those conditions. I am running it live right now (Sim Acct). The strategy stops working after meeting those conditions maybe 3 to 4 times. I have to disable it and able it for the strategy to keep working. Are there settings that do not allow my strategy to keep running? My script seems to be ok.

    #2
    Hello patdmoney,

    Thank you for your post and welcome to the NinjaTrader Forum Community!

    So I may accurately assist you, please answer all of the following questions:
    • When you say that the strategy "stops working" what do you mean? Is it becoming disabled with a message on the Log tab of the Control Center? What color is the strategy name on the Strategies tab of the Control Center when it stops working?
    • Was this strategy created in the Strategy Builder or is it an unlocked strategy in the NinjaScript Editor?
    • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
    • Who are you connected to? This is displayed in green in the lower-left corner of the Control Center window.
    • Who is your broker?
    • What instrument symbol (and expiry if applicable) have you selected? For example, ES 03-22, AAPL, EURUSD, etc.
    • What interval is selected? For example, 5 minute, 1 day, 2000 volume, 4 Renko, etc.
    • Do you receive an error on the screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
    I look forward to your reply.

    Comment


      #3
      Hi Emily,
      • When you say that the strategy "stops working" what do you mean? Is it becoming disabled with a message on the Log tab of the Control Center? What color is the strategy name on the Strategies tab of the Control Center when it stops working?
      It behaves like it is disabled but I don't have any message on the Log tab and it is green when stops working.
      • Was this strategy created in the Strategy Builder or is it an unlocked strategy in the NinjaScript Editor?
      I created it via the NinjaScript Editor.
      • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
      The version number 8.1.2.0 64-bit
      • Who are you connected to? This is displayed in green in the lower-left corner of the Control Center window.
      NinjaTrader
      • Who is your broker?
      NinjaTrader
      • What instrument symbol (and expiry if applicable) have you selected? For example, ES 03-22, AAPL, EURUSD, etc.
      ES 12-23
      • What interval is selected? For example, 5 minute, 1 day, 2000 volume, 4 Renko, etc.
      1 minute
      • Do you receive an error on the screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
      No Errors whatsoever

      Comment


        #4
        Hello patdmoney,

        Thank you for your reply.

        Since there are no error messages and the strategy name still shows in green, that means the strategy is still enabled and set up to submit orders if the proper conditions are met. To debug your strategy and understand why it is not behaving as expected, I suggest enabling TraceOrders to get output related to when orders are submitted, ignored, changed, or canceled:

        This can be enabled by setting TraceOrders to true in State.SetDefaults.

        Another helpful tool for debugging your strategy's behavior is adding print statements throughout your logic. For more information on using prints to debug:


        If you do not understand the output from TraceOrders and/or your prints, please right-click the NinjaScript Output window and select Save As to save the output to a text file. Then, attach the text file with your response so we can take a look and assist you further.

        Please feel free to reach out with any additional questions or concerns.

        Comment


          #5
          Hi, I have enabled the TraceOrders and I got nothing. The strategy works exactly like I want even though it seems to detect the event only three times then I need to disable and enable it like a reset. I was wondering if that was my script that limited me to those 3. It’s kind of kill the purpose of running a script.

          Comment


            #6
            Hello patdmoney,

            Thank you for your reply.

            Please try adding prints, such as a print inside of the condition where the event is detected as well as a general print in OnBarUpdate(). Review the NinjaScript Output window, especially after the three times the event has already been detected, to see which additional prints are generated. If you see only the print from OnBarUpdate() and not the print inside of your condition, that means that the condition is not being triggered again at that point. Printing the values used in the condition can help you understand why it might not be triggered again after the first three times. This would shed some light on what the cause of the unexpected behavior is and what needs to be modified in your logic to get the desired behavior. Something in your script may be limiting you to those 3 events, and prints will help you to determine if that is the case or not and why.

            Thank you for your patience.

            Comment


              #7
              I got it working thanks

              Comment


                #8
                Originally posted by patdmoney View Post
                I got it working thanks
                I have the same issue, what did you find was the problem. My strategeis run, they look enabled, they even priout out in outputs but when I notice there has not been any trades in a long time (epecially overnight) I refresh them all and then magically a bunch of trades are missed that load with the historicals. Here are images of what I mean.
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                31 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                124 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                64 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                41 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X