Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

plot-time

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

    plot-time

    Hello,

    I can plot my lines accessing bars or time, both for current day. But I could not find how I can plot the day before and 2 days ago.

    What do I have to change in the code please for having this line plotted on the chart not today but yesterday and the day before please:

    Today (works ok): Draw.Line(this, "pivot0", false, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 00, 0), pivot0, new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 22, 00, 0), pivot0, Brushes.Green, DashStyleHelper.Solid, 2);

    Yesterday: Draw.Line(this, "pivot1", false, ???, pivot1, ???, pivot1, Brushes.Green, DashStyleHelper.Solid, 2);
    2 days ago: Draw.Line(this, "pivot2", false, ???, pivot2, ???, pivot2, Brushes.Blue, DashStyleHelper.Solid, 2);

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    You could use DateTime.AddDays to add a negative number of days to the current time and use those values to plot your lines:

    Returns a new DateTime that adds the specified number of days to the value of this instance.


    DateTime OneDayAgo = Time[0].AddDays(-1);

    DateTime TwoDaysAgo = Time[0].AddDays(-2);

    You can then use that to build a DateTime like you have in your example.

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    575 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X