Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set isGlobal and Brush to a Draw.Line object?

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

    How to set isGlobal and Brush to a Draw.Line object?

    Hi, i need to set isGlobal=true and a Brush, DashStyle and Width attributes to a draw.line but i cant find a way to do this

    im trying with Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, Brush brush, DashStyleHelper dashStyle, int width) but i cant set global=true

    and trying with Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName) but cant find a way to set Brush, DashStyle and Width

    Can you help me?

    #2
    Hello arbeydario,

    Unfortunately, drawing objects can only be made global with the method call by using the proper overload signature.

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


    Once created, a drawing object cannot be changed to be global (or local).
    However, you can change other properties of the object.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      you said "However, you can change other properties of the object", but i tryed to change brush, dashstyle and width, but does not work, how can i change this properties?

      Comment


        #4
        Hello arbeydario,

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

        Line myLine = Draw.Line(this, "tag1", false, 10, 1000, 0, 1001, true, string.Empty);
        myLine.Brush = Brushes.Blue;
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          it does not work

          MesiasIndicatorcs;'Line' does not contain a definition for 'Brush' and no accessible extension method 'Brush' accepting a first argument of type 'Line' could be found (are you missing a using directive or an assembly reference?);CS1061;502;14;
          MesiasIndicatorcs;'Line' does not contain a definition for 'DashStyleHelper' and no accessible extension method 'DashStyleHelper' accepting a first argument of type 'Line' could be found (are you missing a using directive or an assembly reference?);CS1061;503;14;
          MesiasIndicatorcs;'Line' does not contain a definition for 'Width' and no accessible extension method 'Width' accepting a first argument of type 'Line' could be found (are you missing a using directive or an assembly reference?);CS1061;504;14;



          Click image for larger version

Name:	image.png
Views:	141
Size:	27.5 KB
ID:	1328045

          Comment


            #6
            Hello arbeydario,

            This is unexpected and I was able to reproduce.

            I will need to report this to our developers.

            (Just as a note, this should be the proper way. Another example of this that does work on Dot drawing objects can be found here.
            https://forum.ninjatrader.com/forum/...97#post1068097)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks Chelsea, I will be waiting when you inform me that they corrected it.

              Comment


                #8
                Hello arbeydario,

                Try the following:

                Line myLine = Draw.Line(this, "tag1", false, 10, 1000, 0, 1001, true, string.Empty);
                myLine.Stroke.Brush = Brushes.Blue;​
                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
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 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
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X