Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddChartIndicator unloaded when the account is flattened

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

    AddChartIndicator unloaded when the account is flattened

    Hi, I load an indicator in the chart with my strategy. when the strategy is set to inactive, the indicator is also deleted from the list. this should also be the case when the account is flattened, but it is not. when the account is flattened, the strategy is switched off, but the indicator remains in the list. how can i also deactivate the indicator as soon as the strategy is deactivated or the account is flattened?

    Code:
    sidiPnlPlot = SidiStrategyPnlPlot();
    sidiPnlPlot.Strategy = this; // Create an indicator which is set for a panel plot. The indicator will use this strategies references PanelPlot series to plot.
    AddChartIndicator(sidiPnlPlot);
    deactivated via strategy: all ok
    Click image for larger version

Name:	Screenshot_1.jpg
Views:	335
Size:	108.6 KB
ID:	1137316Click image for larger version

Name:	Screenshot_2.jpg
Views:	281
Size:	88.4 KB
ID:	1137319

    this code is used to execute the flatten command:
    Code:
    Account.Flatten(new[] { Instrument });
    deactivated via flatten: not ok!
    Click image for larger version

Name:	Screenshot_3.jpg
Views:	295
Size:	111.0 KB
ID:	1137317Click image for larger version

Name:	Screenshot_4.jpg
Views:	295
Size:	92.6 KB
ID:	1137318

    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thanks for the post.

    As a quick test do you see this also happen if you use a different indicator that creates a panel like the MACD? Knowing if this relates to the custom indicator or not would be helpful. If you can see this with the MACD I would like to get some more details on the situation such as where the flatten is being called from and the specific steps you used to see that happen. If the MACD does not have this happen that would be a good baseline to know something is happening with the code in the indicator and we would need to look at whats being done in that script.


    I look forward to being of further assistance.

    Comment


      #3
      Hi _Jesse

      As a quick test do you see this also happen if you use a different indicator that creates a panel like the MACD?
      Yes

      I have made a short vid:


      Flattening is done directly via the Flatten button
      Click image for larger version  Name:	Screenshot_1.jpg Views:	0 Size:	19.4 KB ID:	1137342

      if the account is flattened and the strategy is deactivated as a result, the indicators should also be deactivated, right?
      Last edited by sidlercom80; 01-19-2021, 09:54 AM.
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        If the intention is to close the current strategy from within its own logic and disable it you should not use the accounts Flatten method but instead use CloseStrategy to correctly stop the script. I would suggest to test this if that was the intention. https://ninjatrader.com/support/help...=closestrategy

        Unfortunately the video is not currently available. This would be a good situation to post a sample if you have a different use case for the account flatten being used to stop the strategy. Account.Flatten is generally used in combination with addons rather than with strategies. If you have an addon use case or other use case outside of strategy where this is called please provide a sample or accurate description of what would need to be done to generate the problem.

        If you don't want to recreate your button code you can generate a new empty strategy and then add the AddChartIndicaor code with the MACD. You can copy/paste the following button code from the help guide to make a button event to call flatten. Once you confirm that generates the issue please post it and we can test the issue further.





        I look forward to being of further assistance.

        Comment


          #5
          Hi _Jesse video should be online now ;-)

          same problem with CloseStrategy()
          Last edited by sidlercom80; 01-19-2021, 10:20 AM.
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Hello sidlercom80,

            Thanks for posting that detail. To continue from here I would suggest making a new strategy test script to verify this is not related to anything else you are doing in the existing strategy. If that is still happening in a new empty strategy please attach that as a zip and I can pass that to development for further review. The empty test only needs to include an example of how you call the flatten/closeStrategy and the AddChartIndciator with MACD, it does not need any other logic which is not required to see the panel being left.

            Please also check to make sure you are using the current version of the platform as well before uploading a sample.

            I look forward to being of further assistance.

            Comment


              #7
              same problem tested with
              Account.Flatten(new[] { Instrument });
              and
              CloseStrategy("Close");

              vid here:
              sidlercom80
              NinjaTrader Ecosystem Vendor - Sidi Trading

              Comment


                #8
                Originally posted by NinjaTrader_Jesse View Post
                Hello sidlercom80,

                Thanks for posting that detail. To continue from here I would suggest making a new strategy test script to verify this is not related to anything else you are doing in the existing strategy. If that is still happening in a new empty strategy please attach that as a zip and I can pass that to development for further review. The empty test only needs to include an example of how you call the flatten/closeStrategy and the AddChartIndciator with MACD, it does not need any other logic which is not required to see the panel being left.

                Please also check to make sure you are using the current version of the platform as well before uploading a sample.

                I look forward to being of further assistance.
                Here please the .zip file
                Attached Files
                sidlercom80
                NinjaTrader Ecosystem Vendor - Sidi Trading

                Comment


                  #9
                  Hello sidlercom80,

                  Thank you for providing the sample, I was able to see that happen. I will test this further to see if there is any solution otherwise I will be passing this off to development for further review. If I have any updates that I can provide I will post again here.

                  I look forward to being of further assistance.

                  Comment


                    #10
                    Hello sidlercom80,

                    I just wanted to give a quick update here. I was unable to see a correct solution here so I had submitted a bug report, the issue is currently being tracked with the id: 14792.

                    If anything changes surrounding this issue it will be noted in the change log for a future release: https://ninjatrader.com/support/help...ease_notes.htm

                    Please let me know if I may be of additional assistance.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    44 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
                    65 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