Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawLine into the future

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

    DrawLine into the future

    To draw a line into the future, one must supply a startTime and a endTime. Most of the time, for the first DrawLine, Time[0] will be the initial startTime. Now how does one go about calculating the endTime. If the Data Interval is 1-minute then calculating the endtime is rather simple - endTime = Time[0].AddMInute(1). But what do you due when the Data Interval is Tick, Volume, Range, etc.? The x-axis is not fixed like for a minute chart. The x-axis scale is not fixed for a Tick chart. Does one have to worry about screwing up the x-axis when drawing into the future. When drawing into the future on a variable x-axis is the calculation for endTime just as simple as for a minute chart? In other words, one can use endTime = Time[0].AddMinute(1) for all Data Intervals.

    Thanks.

    #2
    Hello scjohn,

    For non time-based charts, each additional bar is projected 1 second beyond the last. It's tricky because as you note, the X axis in the future is dynamic and will change with every incoming tick. Your line can change lengths because of this.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by scjohn View Post
      To draw a line into the future, one must supply a startTime and a endTime. Most of the time, for the first DrawLine, Time[0] will be the initial startTime. Now how does one go about calculating the endTime. If the Data Interval is 1-minute then calculating the endtime is rather simple - endTime = Time[0].AddMInute(1). But what do you due when the Data Interval is Tick, Volume, Range, etc.? The x-axis is not fixed like for a minute chart. The x-axis scale is not fixed for a Tick chart. Does one have to worry about screwing up the x-axis when drawing into the future. When drawing into the future on a variable x-axis is the calculation for endTime just as simple as for a minute chart? In other words, one can use endTime = Time[0].AddMinute(1) for all Data Intervals.

      Thanks.
      No need to calculate. Just use the signature for a time-based line.

      Code:
      DrawLine(string tag, bool autoScale, DateTime startTime, double startY, DateTime endTime, double endY, Color color, DashStyle dashStyle, int width);

      Comment

      Latest Posts

      Collapse

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