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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sjsj2732, 03-23-2026, 04:31 AM
    0 responses
    154 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    356 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    393 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    182 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    138 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X