Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any idea why I can only draw vertical lines on the current day bars?

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

    Any idea why I can only draw vertical lines on the current day bars?

    Hello,

    I use this to draw a vertical line, expecting it to draw for everyday:
    Code:
    Draw.VerticalLine(this, "Trading Open", 10, Brushes.Lime);

    But it only draws it on the current day bars, not on any other days.

    It's a silly thing as I really only care about today ... but it nags at me ...

    Many Thanks, Caesar.

    #2
    Hello Caesar,

    Thank you for your inquiry.

    The most current line is the only one drawn because of the tag "Trading Open" - if you use a unique tag, then multiple lines will be drawn. One of the most simple ways to create a unique tag is to append the CurrentBar index to the end of the tag as follows:

    Code:
    Draw.VerticalLine(this, "Trading Open" + CurrentBar.ToString(), 10, Brushes.Lime);
    This is explained in the description of tag in help guide:

    "A user defined unique id used to reference the draw object.
    For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

    Please let us know if we may be of further assistance.

    Comment


      #3
      Hello Emily,

      Many Thanks for the insight, I am so new at NT8 and learning as I go.

      Best, Caesar.

      Comment


        #4
        Hello Emily,

        It looks like the tag is global? If I draw on another chart I have to use a globally unique tag?

        Many Thanks, Caesar.

        Comment


          #5
          Hello Emily,

          Hmmm ... making the tags unique for both charts has no effect, the second chat doesn't display the vertical lines.

          Many Thanks, Caesar.

          Comment


            #6
            Hello Caesar,

            Thank you for your reply.

            Please clarify; are you looking to have a line that is drawn on one chart be visible on another chart? If so, is it a chart of the same instrument or a different instrument? If possible, please provide screenshots so I may better understand.
            • To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
            • Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save it as a jpeg file and send the file as an attachment.

            I look forward to your reply.

            Comment


              #7
              Hello Emily,

              They are charts of the same instrument, different time series. I just wanted to draw a vertical line at different times as the strategy unfolds.

              Many Thanks, Caesar.

              Comment


                #8
                Hello Emily,

                It works now!

                Many Thanks, Caesar.

                Comment


                  #9
                  Hello Caesar,

                  Thank you for your reply.

                  If you are looking to have the same vertical line drawn on all charts for the same instrument, you would need to set it as a global drawing object. Some of the method overloads for Draw.VerticalLine allow you to set the bool isGlobal to true in order to make the object global:


                  When using the different overloads in the NinjaScript Editor, you can rely on the intelliprompt feature to guide you along:


                  Since you're newer to NinjaScript and getting more comfortable picking things up as you go, I recommend reviewing the resources at the following post to help you practice and expand your knowledge of scripting in NinjaScript:


                  Please feel free to reach out with any additional questions.

                  Comment


                    #10
                    Many Thanks Emily!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    633 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    364 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    567 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    568 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X