Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working with Time and Date

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

    Working with Time and Date

    Hello,

    I can use the Time on current day for indicators and script like if(ToTime(Time[0]) >= 093000 && ToTime(Time[0]) < 161500) then do..
    And I can work with Date like if(Time[0].DayOfWeek != DayOfWeek.Sunday) then do...

    But I dont know how to use Date like "if(Today and ToTime>9:30....) then do" and "if(Yesterday and ToTime>9:30...)" then do....

    Didnt understand it from helpguide (I understand the sample there) nor from forum.

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    To confirm, when you say today, you mean the current date of incoming data, not, say, the current date of the bar being processed, is that correct?

    You could do something like this:

    if (DateTime.Now.Date == Time[0].Date)
    {
    //do something
    }

    For yesterday's date, you could do:

    if (DateTime.Now.AddDays(-1).Date == Time[0].Date)
    {
    // do something
    }

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

    Comment


      #3
      Hello Kate,

      thank you for your reply. Yes, I mean current date of incoming data. I try to work out with this now what I need.

      Thank you for your support!
      Tony

      Comment

      Latest Posts

      Collapse

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