Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to format a isGlobal line

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

    how to format a isGlobal line

    I am writing a simple indicator that draws lines but I would need to change the color, dash type and width. Checking the reference I can't find an overload of Draw.Line() that would allow me to draw this line, format it graphically and make it visible on all graphs in the same tool. How is this possible ?
    What solution can I use ?​

    #2
    i know that i can use a custom template and isGlobal together but i need a lot of templates.... it would be better to set the style directly when I draw the line

    Comment


      #3
      Hello sn0z33r,

      You can save the object to a variable and then set properties on it (that are not in the overload parameters).

      For example:

      Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)

      if (CurrentBar > 5)
      {
      Line myLine = Draw.Line(this, "myLine" + CurrentBar, true, 5, Close[5], 0, Close[5], true, null);
      myLine.Stroke = new Stroke(Brushes.Green, DashStyleHelper.Dash, 5);
      }

      This comes from the code sample in the help guide.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        thank you, I think that's exactly what I was looking for. I will try it right away !

        Comment


          #5
          ok, it works fine but i had to declare myLine as var and force cast to NinjaTrader.NinjaScript.DrawingTools.Line

          var myLine = Draw.Line(this, "myLine" + CurrentBar, true, 5, Close[5], 0, Close[5], true, null) as NinjaTrader.NinjaScript.DrawingTools.Line;
          myLine.Stroke = new Stroke(Brushes.Green, DashStyleHelper.Dash, 5);

          Comment


            #6
            Hello sn0z33r,

            This may be due to use var as the variable type instead of Line.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X