Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

moving a Line

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

    moving a Line

    I know that Add() can only go in Initialize().

    Add(new Line(Color.DarkGray, threshold, "Upper"));
    Add(new Line(Color.DarkGray, -threshold, "Lower"));

    Since threshold is a user input, if the threshold is changed, the Line should move. It doesn't - I believe user input changes are supposed to be known going into Initialize(), so this might be a bug. (64-bit v7..4)

    I tried placing the Add() in the OnStartUp() method, but that does not work.

    The Lines have names... How do I update them ?

    I do NOT want to make a plot of a constant line and update it on every tick. That would be a silly waste of overhead. It also would not extend the line all the way to the right edge but would stop on the last bar.

    There must be a reasonable way to do this? Thanks

    #2
    Lost Trader, to clarify, you have an indicator that draws some constant lines defined by user input and the lines don't change if you go into the indicator property window and change the values and hit apply? Or are you trying to update the lines from within your indicator?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Constant Lines at value set by User input. When input value changed in the indicator property window and applied, lines are not moved.
      I do NOT want to change during OnBarUpdate().

      Code:
                  Add(new Line(Color.DarkGray, threshold, "Level 1"));
                  Add(new Line(Color.DarkGray, 0, "Zero line"));
                  Add(new Line(Color.DarkGray, -threshold, "Level -1"));
      threshold is a user input variable:
      Code:
              [Description("threshold for trigger filtering. Must be greater than zero.")]
              [GridCategory("Parameters")]
              public double Threshold
              {
                  get { return threshold; }
                  set { threshold = Math.Max(0.001, value); }
              }
      BTW, default value is 50.

      Comment


        #4
        Lost Trader, can you please attach the full script so I can test this out on my end?
        AustinNinjaTrader Customer Service

        Comment


          #5
          It is a variant on CCI
          Attached Files

          Comment


            #6
            LostTrader, you would use the .Value property of your Lines collection here --

            i.e. Lines[1].Value = Threshold;

            Comment


              #7
              And apparently it must be done in OnStartUp() because it didn't work in Initialize().

              Thank you, Bertrand.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              558 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X