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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    91 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    48 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    105 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X