Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 elirion, Yesterday, 09:32 PM
      0 responses
      8 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by cre8able, Yesterday, 09:15 PM
      1 response
      8 views
      0 likes
      Last Post bltdavid  
      Started by cummish, Yesterday, 08:43 PM
      0 responses
      16 views
      0 likes
      Last Post cummish
      by cummish
       
      Started by Option Whisperer, Yesterday, 07:58 PM
      4 responses
      21 views
      0 likes
      Last Post Option Whisperer  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      13 responses
      87 views
      0 likes
      Last Post ETFVoyageur  
      Working...
      X