Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I draw a short line one bar into the future?

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

    Can I draw a short line one bar into the future?

    if so, how do i go about doing that?

    #2
    kaywai, you could draw into the future using into NT7 by supplying a future DateTime end point for your DrawLine call - http://www.ninjatrader.com/support/h...7/drawline.htm

    Comment


      #3
      Hi Bertrand,

      Not exactly sure what you mean by "by supplying a future DateTime end point ".

      If for example I would like to draw a line from the current bar to the "next bar" which is to the right of the current bar, what would I put as the future DateTime?

      Regards

      Kay Wai

      Comment


        #4
        For example, if you're current 5 min bar is at 10:00, a future end point expressed in DateTime would be 10:05, 10:10...

        Comment


          #5
          what i'm actually looking for is for the DrawLine function to draw a line to the right of the current bar, irrespective of the timeframe used and prior to the new bar being drawn.

          Comment


            #6
            Kay, this is unfortunately not supported on a per bar basis, you can draw into the future if you anchor the end point of the line at a future DateTime.

            Comment


              #7
              Kay, this is unfortunately not supported on a per bar basis, you can draw into the future if you anchor the end point of the line at a future DateTime.
              Bertrand I think that Kaywai is right, NT need to allow it on a bar basis. DateTime is good for time bars (minute, day...) but not for tick charts. How NT can know where the 10:15 bar will be on a tick chart???
              I believe that by drawing into the future with DateTime ninja internally translates it to bars and from bars to pixels. So NT calculates that the end point is 4 bars away, each bar width is X pixels and space btw bars is Y pixels so draw it to Z.

              Baruch

              Comment


                #8
                If you draw with a Ray instead of a Line, it will draw to the edge of the chart.
                RJay
                NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                Comment


                  #9
                  Thanks for voicing your feedback Baruch - unfortunately it could not be tied to bars as when moving off time based charts there would be no way to 'know' where the future bar would be - thus in NT7 the draw signatures have a direct DateTime anchor based input you would then use to draw at an exact end point - of course arriving at that point on the chart a 'guesstimate' is involved until the DateTime is reached.

                  Comment


                    #10
                    if I am using daily bar chart, and i wanted to draw a line,

                    1) can i draw it on tomorrow's bar? if so how would i code tomorrow's bar?
                    2) can i draw a line where the length of the line is the same as the width of a bar and position it in a "centred" aligment across the bar?

                    Comment


                      #11
                      Yes, you can supply a future DateTime on daily series as well, for the endpoint for example Time[0].AddDays(1) to be tomorrow. The line would be then drawn from midpoint to midpoint.

                      Comment


                        #12
                        Hi Bertrand, Here are my codes:-

                        Code:
                        [FONT=Courier New][SIZE=2]
                        [SIZE=2][FONT=Courier New]DrawLine([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"myLine1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+CurrentBar, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].AddDays([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]), projectedhigh, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].AddDays([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]), projectedhigh, Color.DarkBlue, DashStyle.Solid, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                        [/SIZE][/FONT]
                        Code:
                        [FONT=Courier New][SIZE=2]
                        [SIZE=2][FONT=Courier New]DrawLine([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"myLine2"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+CurrentBar, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].AddDays([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]), projectedlow, Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].AddDays([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]), projectedlow, Color.Purple, DashStyle.Solid, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                        [/SIZE][/FONT]
                        I've attached a image of the chart. As you can see, some lines are longer than other AND they are not drawn from midpoint to midpoint. Can you please assist?

                        Regards

                        Kay Wai
                        Attached Files

                        Comment


                          #13
                          With AddDays(0) you're not using any future datetime here...you would also need a weekend logic in your script I believe to cover those cases as well.

                          Comment


                            #14
                            Hi Bertrand,

                            if the start and end are both Time[0].AddDays(1), i can't even get a line to display! With the start and Time[0].AddDays(1), I can actually see a line! How do I get the line to draw from midpoint-to-midpoint?

                            And you're right about the weekend...it is the Friday lines that are shorter...

                            I imagine it would be along the lines of...
                            if (Time[0].DayOfWeek == DayofWeek.Friday)...

                            Comment


                              #15
                              All resolved Bertrand! Thx!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              601 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              558 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X