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

Remove draw object line after refresh

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

    Remove draw object line after refresh

    Hi

    I have one property to draw one line.

    I draw the line getting the propierty value in OnBarUpdate when CurrentBar == 0.

    I want to delete all the indicator's line before drawing the line, because when I change the property value and press F5 the line value doesn't refresh.

    Regards

    #2
    Hello davidgamo,

    Thank you for your post.

    Are you changing the value in code or the Indicators menu?

    Comment


      #3
      Hi

      1) I add the indicator, and in the parameteres menu I set the propierty levels = 1953,09;1963,05;

      I click OK button

      Initialize()
      {
      string[] values = levels.Split(new char[] { ';' });
      foreach (string value in values)
      {
      Line line = new Line(new Pen(Color.Red, 2), number, "sr" + (++count));
      Add(line);

      }
      }

      I see the two lines in the chart.

      2) I open the indicator menu again, and in the parameteres I set the propierty levels = 1954,00;

      I click OK button

      But I see the two last lines. I have tried to delete all the lines in the chart, before the code but the Lines.Length = 0

      Regards

      Comment


        #4
        Hello davidgamo,

        Thank you for your response.

        There is no method or function to explicitly remove a line that was created via the Intialize() method. You would need some sort of reset for your array. If you add the lines just using Add() and not the array or for loop you should be able to re-adjust the lines.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        22 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        21 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Working...
        X