Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issues with Strategy Removal and Execution

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

    Issues with Strategy Removal and Execution

    Hello,

    As you can see, I have removed the strategy from the chart, but it is still running (as shown in the NinjaScript Editor output).
    Occasionally, restarting NinjaTrader resolves the issue and removes the strategy, but not always. This makes it very difficult to develop strategies, as I have to restart NinjaTrader every 30 minutes.

    Additionally, the NinjaScript output shows that two strategies, v006 and v007, are being executed. This is another issue because strategy v006 no longer exists.

    Thank you for your attention to these matters.

    #2
    Hello NT,

    I'm wondering why my question on the forum has not been answered yet. Could you please check if it was overlooked?

    Thank you for your attention!

    Comment


      #3
      Hello lauerbrazil,

      Thank you for your post.

      The output suggests you are using a trade copier - Does this behavior still occur without the use of a Trade Copier?

      Comment


        #4
        Hello,

        Thank you for your response.

        To clarify, I am not using a trade copier; I am actually developing one myself. If needed, I would be happy to share the code with you.

        Yes, I am creating a copy of my trades from account 1 to account 2, but this functionality is entirely developed by me.

        Thank you in advance for your support.

        Best regards,

        Comment


          #5
          Hello lauerbrazil,

          Can you confirm if the issue occurs without the use of your trade copier? i.e. can you reproduce the strategy continuing to execute despite being disabled without the trade copier?

          If the issue doesn't occur without the use of the trade copier, this would suggest the issue is related to your trade copier's logic. In that case you would need to debug your trade copier to diagnose the behavior.

          Comment


            #6
            Hello,

            This issue isn't something I can debug on my end. While I can verify if my strategy is functioning correctly (e.g., ensuring variables are initialized or set to zero), the core problem lies elsewhere: the strategy is not being unmounted properly. It seems to persist somewhere - either in memory or within a folder of the NinjaTrader installation.

            For instance, even if I were to create a strategy with several coding errors that compiles successfully and executes, it doesn't explain why a strategy wouldn't be removed when I explicitly remove it from the chart. Developer errors shouldn't, in theory, impact NinjaTrader's internal mechanisms for handling strategy removal. This doesn't appear to be a developer-side issue.

            Additionally, I'm limited in what I can debug. While I can print variables from my strategy, I have no way to access or inspect NinjaTrader's internal variables or processes that manage user-developed strategies.

            To clarify further, the trade copier is the strategy. It's not using an external trade copier application; the strategy itself handles the trade copying. Does that make sense? This is why I suggested that reviewing the code might be beneficial.

            As a potential workaround, I could create a simpler strategy that doesn't copy trades, but I suspect the issue would disappear in that case. This leads me to believe that NinjaTrader might have challenges managing strategies using two accounts.

            Can NinjaTrader strategies effectively handle trades across two accounts?
            Or strategies cannot be used in that way?

            Thank you for your time and assistance!

            Best regards,
            Leonardo.
            Last edited by lauerbrazil; 01-08-2025, 02:56 PM.

            Comment


              #7
              More Info:
              I place trades directly from the chart. The strategy intercepts this interaction using the OnOrderUpdate method.
              • The initial order is not created by the strategy; it comes from outside.
              • The strategy then creates a new order based on the type of order it receives in the OnOrderUpdate method.

              Could this setup - where the strategy handles externally placed trades - lead to unexpected behavior? I'm wondering if this is not what strategies were designed for, and perhaps this workflow is contributing to the issue.
              Thanks

              Comment


                #8
                Hello,

                the core problem lies elsewhere: the strategy is not being unmounted properly. It seems to persist somewhere - either in memory or within a folder of the NinjaTrader installation.
                If there is an issue with NinjaTrader, we would need reproduceable steps in order to report an issue to our Development Team. This is why I'm inquiring if you can reproduce the issue of a strategy continuing to execute after being disabled without the use of your trade copier.

                Could this setup - where the strategy handles externally placed trades - lead to unexpected behavior?
                No, if you are using NinjaScript Strategy specific methods - it is not supported for NinjaScript strategies to execute trades on more than one account. Nor are they meant to handle external or manual orders, NS Strategies are only meant to handle orders generated from the strategy itself.

                Comment


                  #9
                  Hello,

                  Thank you for your response.

                  No, if you are using NinjaScript Strategy specific methods - it is not supported for NinjaScript strategies to execute trades on more than one account. Nor are they meant to handle external or manual orders, NS Strategies are only meant to handle orders generated from the strategy itself.
                  I understand that using the strategy in this way could lead to unexpected behavior.

                  What do you suggest I use to develop a copy trader with NinjaScript?

                  Thank you for your guidance.

                  Best regards,
                  Leonardo

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  127 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  42 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