NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 03-18-2008, 05:32 PM   #1
altrader
Member
 
Join Date: Mar 2008
Posts: 49
Thanks: 0
Thanked 0 times in 0 posts
Default 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
altrader is offline  
Reply With Quote
Old 03-18-2008, 06:11 PM   #2
Pete S
Senior Member
 
Join Date: Jul 2007
Location: Fairfax, VA
Posts: 216
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
Pete S is offline  
Reply With Quote
Old 03-19-2008, 02:52 PM   #3
altrader
Member
 
Join Date: Mar 2008
Posts: 49
Thanks: 0
Thanked 0 times in 0 posts
Default

Perfect, cheers.
altrader is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is hour granularity unsupported? henry.omd Miscellaneous Support 1 12-24-2007 09:53 AM
chart time is one hour behind sean606 Charting 3 11-04-2007 07:07 PM
How to hold a position for half hour? Jenny Strategy Development 13 10-23-2007 09:17 PM
1st Hour High/Low pijamatrader Indicator Development 42 07-16-2007 05:31 PM
OHLC for non-midnight 24 hour market StinkiePhish Indicator Development 1 07-12-2007 11:07 PM


All times are GMT -6. The time now is 05:22 PM.