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 fernandobr, Today, 09:11 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by timmbbo, Today, 08:59 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by KennyK, 05-29-2017, 02:02 AM
        2 responses
        1,281 views
        0 likes
        Last Post marcus2300  
        Started by itrader46, Today, 09:04 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Working...
        X