Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting line width statements

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

    Setting line width statements

    I am new to programming in NT and have looked around the reference samples and cannot find an example of the statement so I can manually set the width parameter in an indicator for an added line statement.

    I have statement that I added:

    Add(new Line(Color.White, -20, "Upper"));

    I do not know what statement to add that will set the width of this line from the default of 1. I also have several of these lines added so I also need the reference so I can set each one that I have added to it's respective user defined default.

    I appreciate any information you might be able to provide.

    #2
    Hi Terrangbil,

    One of our NinjaScript trainees will respond to you later today. Thank you for your patience.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Try this after your Add() line.
      Code:
      Lines[0].Pen.Width = 2;
      Last edited by NinjaTrader_JoshP; 10-28-2008, 10:13 AM.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Thanks Josh,

        Through common sense I tried the "lines" instead of "plots" and it would not compile. But I will go back and try it again. I must have had something wrong.

        Thanks again!

        Comment


          #5
          Originally posted by Terrangbil View Post
          Add(new Line(Color.White, -20, "Upper"));

          I do not know what statement to add that will set the width of this line from the default of 1.
          Pens have widths, so you can set a pen when you add a line, like this:

          Add(new Line(new Pen(Color.White, 2), -20, "Upper"));

          Josh's suggestion should work too. Remember that this programming language is case-sensitive! So Lines[0].Pen.Width=2 should work (note the first character is capitalized). If you use "lines[0]" (lowercase) as you indicated above, it won't work.
          -Alex
          Last edited by anachronist; 10-28-2008, 12:16 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 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
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X