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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      151 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      304 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      345 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      175 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X