Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

horizontal lines

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

    horizontal lines

    Hello,

    I want to ask please if its possible that the horizontal line starting with the open of rth session is plotting more to the right than the last (current) bar. I have
    Draw.Line(this, "L1", false, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 30, 0), L1, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 16, 15, 0), L1, Brushes.Blue, DashStyleHelper.DashDot, 2); but it doesnt plot into the "future" to time 16,15, 0 instead it stops current bar.

    I tried different methods to resolve but couldnt do it:
    a.) When I use instead of time bars, barsago, bars-x.... I can plot to the right to y-axis but I can not start the plotting at 9:30.
    b.) When I try to combine time for staring and and bars-x for ending of plotting I get an error message when compiling.

    How can I plot the line starting 9:30 EST and plot to right margin of chart/y-axis.

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    Do you mean plotting into the future? This is not possible with drawing objects as they are mapped to specific bars.

    You could instead use custom rendering to render a line to the empty space to the right of the bars.

    Comment


      #3
      Hello,

      thank you for your reply. I dont understand what you mean with "not possible with drawing objects....". Attached is a screenshot where you can see that one can plot the horizontal line more to the right than the last bar with

      Draw.Line(this, "L_10", false, 5, L2, -10, L2, Brushes.Blue, DashStyleHelper.DashDot, 2);
      Draw.Line(this, "L_20", false, 8, L2+10*TickSize, -20, L2+10*TickSize, Brushes.Blue, DashStyleHelper.DashDot, 2);​

      But how do I get the first bar of rth session to start the plotting when not using the time together with bars.

      Thank you!
      Tony
      Attached Files

      Comment


        #4
        Hello tonynt,

        Apologies, I should have used different wording. While it is technically possible, it is not officially supported as drawing objects are not intended to be used this way. While it may work for the available slots on the chart - eventually it will stop working as those slots are also not fixed (like chart bars are) so you could end up having it shift positions later once bars fill those slots.

        Our recommended solution is to instead custom render the lines if you would like to draw into the future.

        Comment


          #5
          Hello,

          thank you for your reply. Please forget about my question how to plot to the right and let me modify my question to ask only now how one can get the firstbarof the rth session to use in the script to start plotting from there. I recall it is possible but I do not recall how I had done years ago. It was somehow like "currentbar - xy...."

          Thank you!
          Tony

          Comment


            #6
            Hello tonynt,

            Thank you for your inquiry.

            Is your Data Series already using RTH as the trading hours template?

            If so, you can simply use isFirstBarOfSession.

            Comment


              #7
              Hello,

              thank you for your reply. As I´m running it on a 24/5 chart this will not work. I recalled that it was plotting as expected on another computer. Please see attached the screenshot: this is European timezone on the computer and the lines is plotting from 09:00 European time to 22:00 European time which is to the end of day and not only to last bar.

              Draw.Line(this, "DL1", false, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 00, 0), DL1, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 22, 00, 0),DL1, Brushes.Red, DashStyleHelper.DashDot, 2);​

              When will it work and when not with the time in the code please?

              Thank you!
              Tony
              Attached Files
              Last edited by tonynt; 09-17-2024, 06:32 AM. Reason: Translation error

              Comment


                #8
                Hello tonynt,

                Are you supplying a future time to this Draw.Line() call? Unexpected behavior can occur when using unsupported code. We wouldn't be able to predict when/how the unsupported code is going to break.

                So if you are trying draw a line until to 22:00 o'clock on that call, the script would have had to already process a bar with that timestamp in order for this Draw.Line call to work as expected.

                You can detect the start of the RTH session instead by using a simple time condition, however please note it is not supported to then call Draw.Line() on that bar and supply a future DateTime which has not yet occurred.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                595 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 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
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                554 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X