Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Making Line auto adjust/extend till end time on 300 tick chart

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

    Making Line auto adjust/extend till end time on 300 tick chart

    I am trying to draw a line from start time (6am) till close time next day (Day+1, 5am)

    However as I am using 300 ticks chart, there is no way I can determine the length of today's chart ( as in the number of candles within the day's trade session).

    But for the DrawLine function it draws a fixed length. When the number of candles exceed this line line, the line will not readjust or auto extend.

    Is there anyway to fix this?

    The codeI am using is:
    DateTime NextDay = Time[0].Add(tsOneDay);
    DateTime StartTime = new DateTime(Time[0].Year, Time[0].Month,Time[0].Day,6,0,0);
    DateTime EndTime = new DateTime(NextDay.Year, NextDay.Month, NextDay.Day,5,0,0);

    DrawLine(cirrentbar.tostring(), false, StartTime , High[0], EndTime, High[0],Color.Aquamarine,DashStyle.DashDotDot, 2);

    Thanks
    Last edited by ystan79; 07-30-2014, 11:03 PM.

    #2
    ystan79, welcome to our forums here - I think the issue is rather in the unique tag you use for the line per bar, meaning you create a high amount of lines. Drawing this time based on the tick charts should be fine, but I would look into just using one tag per session here. For example Bars.SessionBreak would give you an event in OnBarUpdate() to create a session count which you could potentially use a suffix for your tag to make a unique one per session for the line.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by elirion, Today, 01:36 AM
    0 responses
    3 views
    0 likes
    Last Post elirion
    by elirion
     
    Started by gentlebenthebear, Today, 01:30 AM
    0 responses
    4 views
    0 likes
    Last Post gentlebenthebear  
    Started by samish18, Yesterday, 08:31 AM
    2 responses
    9 views
    0 likes
    Last Post elirion
    by elirion
     
    Started by Mestor, 03-10-2023, 01:50 AM
    16 responses
    391 views
    0 likes
    Last Post z.franck  
    Started by rtwave, 04-12-2024, 09:30 AM
    4 responses
    34 views
    0 likes
    Last Post rtwave
    by rtwave
     
    Working...
    X