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 WNorton, Today, 11:23 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Spencer  
      Started by stafe, Today, 10:43 AM
      0 responses
      9 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by UltraNIX, Today, 09:13 AM
      2 responses
      16 views
      0 likes
      Last Post UltraNIX  
      Started by Tuxstuff215, Today, 06:32 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by carlot, Today, 08:10 AM
      2 responses
      26 views
      0 likes
      Last Post carlot
      by carlot
       
      Working...
      X