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 kempotrader, Today, 08:56 AM
        0 responses
        7 views
        0 likes
        Last Post kempotrader  
        Started by kempotrader, Today, 08:54 AM
        0 responses
        4 views
        0 likes
        Last Post kempotrader  
        Started by mmenigma, Today, 08:54 AM
        0 responses
        2 views
        0 likes
        Last Post mmenigma  
        Started by halgo_boulder, Today, 08:44 AM
        0 responses
        2 views
        0 likes
        Last Post halgo_boulder  
        Started by drewski1980, Today, 08:24 AM
        0 responses
        4 views
        0 likes
        Last Post drewski1980  
        Working...
        X