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

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 Javierw.ok, Today, 04:12 PM
          0 responses
          3 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Started by alifarahani, Today, 09:40 AM
          6 responses
          40 views
          0 likes
          Last Post alifarahani  
          Started by Waxavi, Today, 02:10 AM
          1 response
          18 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Kaledus, Today, 01:29 PM
          5 responses
          15 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X