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

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 PhillT, 04-19-2024, 02:16 PM
      4 responses
      35 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Started by ageeholdings, 05-01-2024, 05:22 AM
      5 responses
      37 views
      0 likes
      Last Post ageeholdings  
      Started by reynoldsn, Today, 02:34 PM
      0 responses
      13 views
      0 likes
      Last Post reynoldsn  
      Started by nightstalker, Today, 02:05 PM
      0 responses
      20 views
      0 likes
      Last Post nightstalker  
      Started by llanqui, Yesterday, 09:59 AM
      8 responses
      32 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Working...
      X