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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          210 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          120 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          145 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          227 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          188 views
          0 likes
          Last Post CarlTrading  
          Working...
          X