Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawLine on volume charts

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

    DrawLine on volume charts

    This code works as expected on time charts. On volume charts, however, it starts out correctly but as the bar progresses the line moves back to the prior bar.

    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    // Plot0.Set(Close[0]);

    if (!Historical) DrawLine(CurrentBar.ToString(),true,0,High[0] + 2,0,Low[0]-2,Color.Chocolate,DashStyle.Dash,2);

    }

    #2
    Thanks for reporting. We will look into it.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      palinuro,

      This occurs because draw objects are now anchored based on time. When you first drew the line it was at a certain timestamp. As the volume bar builds it keeps changing timestamps, but your line was already of an earlier time stamp so it seems like it is moving.

      To address you could try using the DateTime signature and just pass in Time[0] as the time you want to draw on and keep refreshing that line based on the latest volume bar's time. Note that if you are using very short volume/tick charts you can end up with multiple bars with the same time stamp and in those instances the line would go on the very first bar with that time stamp.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Thanks, that does it.

        Comment

        Latest Posts

        Collapse

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