Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to execute something every hour/half hour etc

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

    How to execute something every hour/half hour etc

    Hi Guys, hopefully soon I'll start asking questions that are beyond novice level!

    However, say I have CalculateOnBarClose set to false and I want to do something at certain intervals, how can I code this?

    For example if I wanted to check every 60 minutes i could write
    pseudocode
    if time=09:00||10:00||11:00 ... etc or variations of that theme
    do something

    But there must be a more efficient way to do this i.e. some way to say
    if last two digits of time are 00 ... or 25 or whatever
    do something

    Like a substring type function? Been a while since I last wrote any code properly and I'm new to c#.

    Thanks,
    Al

    #2
    Just type Time[0]. into the editor, you will see the fields available in the time structure. You don't need to parse any strings, just evaluate those fields.

    Comment


      #3
      Perfect, cheers.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      87 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      106 views
      0 likes
      Last Post CarlTrading  
      Working...
      X