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 alifarahani, Today, 09:40 AM
      6 responses
      36 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Waxavi, Today, 02:00 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by gentlebenthebear, Today, 01:30 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X