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

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 ZenCortexHurry, Today, 01:07 PM
          0 responses
          2 views
          0 likes
          Last Post ZenCortexHurry  
          Started by ZenCortexHurry, Today, 01:04 PM
          0 responses
          1 view
          0 likes
          Last Post ZenCortexHurry  
          Started by f.saeidi, Today, 12:14 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Russ Moreland, Today, 12:54 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by philmg, Today, 12:55 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X