Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

updating a plot line in the Initialize section

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

    updating a plot line in the Initialize section

    Hi
    Code:
    protected override void [B]Initialize()[/B]
            {
                Add(new Line(System.Drawing.Color.DarkViolet, rocOB, "ROCob"));
                Add(new Line(System.Drawing.Color.DarkViolet, rocOS, "ROCos"));
                 etc....
    Is there a way to change for example the "ROCob" 'private int' while running on a chart ?
    thanks

    #2
    Can't !! in this section.

    Comment


      #3
      Hello,
      You could achieve this by setting the Lines[0].Value in the code. For more information on Lines[].Value please see the following link: http://ninjatrader.com/support/helpG...line_class.htm
      For example:
      Code:
      private int rocOB = 20; 
      protected override void Initialize()
      {
           Add(new Line(System.Drawing.Color.DarkViolet, rocOB, "ROCob"));
      }
      protected override void OnBarUpdate()
      {
          if(SMA(20)[0] > Close[0])
          {
               rocOB = 50;
               Lines[0].Value = rocOB
          }
      }
      I would like to note that Lines do not autoscale the chart to show the values. If you are looking for lines to autoscale I would recommend to use IHorizontalLine objects instead. Please see the following link for more information on the IHorizontalLine objects: http://ninjatrader.com/support/helpG...zontalline.htm
      Cody B.NinjaTrader Customer Service

      Comment


        #4
        Thanks Cody,
        this is a horizontal line (max and min of ROC) and i want adjust the settings manually of rocOB when added to the indicator. (normaly 10 and -10 on the right side)
        But the new settings don't change the horizontal line.
        Attached Files
        Last edited by mate41; 03-23-2016, 07:42 AM.

        Comment


          #5
          Hello,
          When you apply the indicator it should change the values of the lines.
          If it does not change the values after applying pleas let me know.
          Cody B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          626 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          359 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          562 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          567 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X