Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dashed Line by default?

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

    Dashed Line by default?

    I must be missing something but how do you create a Dashed line by default.

    I can create a line using this:

    Add(new Line(Color.FromKnownColor(KnownColor.Red), 45, "myLine"));

    And then if I load the indicator I can change it from a solid line to a dashed line... but how can I set it a dashed line in my code.

    The property is called Dash style in the properties window of the chart.

    I would have thought it would be something like...

    Add(new Line(Color.FromKnownColor(KnownColor.Red), 45, DashStyle.dash, "myLine"));

    Anyone know how to do this? I know it's a simple question but I looked in the forums and didn't see an answer.

    #2
    After the Add().
    Lines[0].Pen.DashStyle = DashStyle.Line;
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Wow... sometimes it's so easy. Thanks, Josh. I know I'm probably asking a question that's been asked and answered 1000 times. Your patience with us all does not go unnoticed!

      That totally worked!

      Comment


        #4
        While we're on the subject... is there a way to refer to lines and plots by name and not by index?

        For example Lines[0] or Lines["myLine"]

        The latter would seem more stable if I end up rearranging or pulling lines from the indicator.

        Comment


          #5
          Unfortunately not.

          Plot names are given in the Properties region and then you can go PlotName.Set() or whatever you need.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

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