NinjaTrader Support Forum  

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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 08-14-2009, 10:31 AM   #1
leontancfa
Member
 
Join Date: Nov 2008
Posts: 95
Thanks: 0
Thanked 0 times in 0 posts
Default what is the property of current bar's close time?

solved. thanks.
Last edited by leontancfa; 08-14-2009 at 10:43 AM. Reason: solved
leontancfa is offline  
Reply With Quote
Old 08-14-2009, 10:38 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Not sure what you mean. Time[0] gives you the timestamp of the bar which is the closing timestamp of that bar when using time intervals.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-14-2009, 10:41 AM   #3
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

To build on what Josh said, a solution to find a bar's closing time would be to use Time[0] and add the time from BarsPeriod.Value if BarsPeriod.Id == PeriodType.Minute/some other time based period.
Code:
// all the following code is untested, but should show the general idea.
DateTime timeOfInterest = Time[0]

// set timeOfInterest to the time of the current bar + the period of  the chart
timeOfInterest = Time[0].AddMinutes(BarsPeriod.Value);
Last edited by NinjaTrader_Austin; 08-14-2009 at 10:45 AM.
NinjaTrader_Austin 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
Can cross hair mode show the time beyond the current time? leontancfa Charting 3 07-01-2009 08:42 AM
Replay's Current Time, Time[0] isn't what I'm expecting Brian1 Strategy Analyzer 4 02-19-2009 02:09 PM
Exit positions on current bar close forextim Strategy Development 1 11-12-2008 08:39 AM
Added Property to Strategy but Not Showing on Property Grid stocastix Automated Trading 2 11-07-2008 04:00 PM
how to sendmail() with current symbol and close price tbtrades Miscellaneous Support 3 10-17-2008 12:28 PM


All times are GMT -6. The time now is 10:12 PM.