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 AaronKoRn, Today, 09:49 PM
          0 responses
          6 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          9 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          10 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,976 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X