Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator disappears after Remove All Draw Objects

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

    Indicator disappears after Remove All Draw Objects

    I've developed a tick based indicator that draws DrawText objects on the main price panel (1) and Lines andPlots in a panel (2). I also have another indicator - BuySellVolume in panel (3).

    When I select Remove All Draw Objects from the chart drawing tools combo, it deletes the entire indicator from panel 2 (including the name) and deletes the Drawtext objects from the main price panel 1. However, BuysellVolume in panel 3 is unaffected.

    Pressing F5 restores the deleted indicator.

    I suspect that I have left out a key command from my code that prevents some objects from being deleted.

    Any help would be much appreciated.

    Thanks.




    #2
    imported post

    Please check the logs. There likely are funny error message related to your indicator. This then would mean, that your indicator is disabled since it caused some problem.

    If that is the case I suggest commenting out suspicious code step by step and thus isolation the cause of trouble.

    Comment


      #3
      imported post

      Yes, there is an error in the log and it is down to the DrawText method. Below is a test script that prints "ABC" at the close of the 10th latest bar and provides the error.

      The indicator works fine until clicking Remove All Draw Objects produces "Error on calling the 'OnBarUpdate' method for indicator 'TestDrawText' on bar nnnn. Cannot remove the specified item because it was not found in the specified collection."

      Any ideas? Have I missed anything?

      Code:
      protected override void Initialize()
      {
      AutoScale = true;
      CalculateOnBarClose = true;
      Overlay = true; 
      }
      
      protected override void OnBarUpdate()
      {
      if (Historical)
       return;
      
      DrawText("ABC", "ABC", 10, Close[10] , Color.Blue);
      }


      Comment


        #4
        imported post

        This is a bug which will be fixed with next update.

        Thanks for reporting that one.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by yertle, Today, 08:38 AM
        0 responses
        4 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by Mestor, 03-10-2023, 01:50 AM
        15 responses
        378 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by samish18, Yesterday, 08:57 AM
        10 responses
        27 views
        0 likes
        Last Post samish18  
        Started by matty89, 03-02-2020, 08:31 AM
        34 responses
        3,039 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by kujista, Today, 05:44 AM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X