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

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.
    Emily C.NinjaTrader Customer Service

    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.
            Emily C.NinjaTrader Customer Service

            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.
                  Emily C.NinjaTrader Customer Service

                  Comment


                    #10
                    Many Thanks Emily!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by thanajo, 05-04-2021, 02:11 AM
                    3 responses
                    469 views
                    0 likes
                    Last Post tradingnasdaqprueba  
                    Started by Christopher_R, Today, 12:29 AM
                    0 responses
                    10 views
                    0 likes
                    Last Post Christopher_R  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    166 responses
                    2,237 views
                    0 likes
                    Last Post sidlercom80  
                    Started by thread, Yesterday, 11:58 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post thread
                    by thread
                     
                    Started by jclose, Yesterday, 09:37 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post jclose
                    by jclose
                     
                    Working...
                    X