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 06-27-2012, 07:38 AM   #1
alexeymarvel
Junior Member
 
Join Date: Feb 2011
Posts: 12
Thanks: 0
Thanked 1 time in 1 post
Default Time value

Can you advise how to get a time value updated each second?

ToTime(Time[0]) function gives only a value of bar's opening.
alexeymarvel is offline  
Reply With Quote
Old 06-27-2012, 07:42 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello alexeymarvel,
You can use the DateTime.Now function to get the current timestamp of your PC.

http://msdn.microsoft.com/en-us/libr...etime.now.aspx

Please note it will work in realtime only and not for historical bars or in backtesting.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 06-27-2012, 07:43 AM   #3
alexeymarvel
Junior Member
 
Join Date: Feb 2011
Posts: 12
Thanks: 0
Thanked 1 time in 1 post
Default

Yes I Know how to get it in real time. But how to get it in market replay mode?
alexeymarvel is offline  
Reply With Quote
Old 06-27-2012, 07:51 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello alexeymarvel,
You can try the below unsupported code

Code:
this.Bars.MarketData.Connection.Now
Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 06-30-2012, 04:51 AM   #5
alexeymarvel
Junior Member
 
Join Date: Feb 2011
Posts: 12
Thanks: 0
Thanked 1 time in 1 post
Default

It gives the same value as Time[0] as at bar's open. But I need the timer the same as in the replay window.
alexeymarvel is offline  
Reply With Quote
Old 06-30-2012, 10:22 AM   #6
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,201
Thanks: 24
Thanked 1,227 times in 998 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by alexeymarvel View Post
It gives the same value as Time[0] as at bar's open. But I need the timer the same as in the replay window.
In what event handler are you using the construct ?
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 07-02-2012, 04:11 AM   #7
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello alexeymarvel,
In addition to koganam's query, can you say what CalculateOnBarClose you are using?

I look forward to assisting you further.
NinjaTrader_Joydeep 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
Math.max method? Long time reader, first time poster ;) backspace123 General Programming 3 02-08-2012 12:01 PM
how to use weekly, monthly, yearly time frames in real time charting using 6.5 versi qwert12 Charting 2 10-05-2010 04:35 PM
Highest High/Lowest Low from xxxx time to yyyy time... Unhommefou Indicator Development 3 03-22-2010 02:00 PM
Multi-time frame strategy - Longer-term real-time calculations Shansen Strategy Development 1 04-19-2009 06:36 AM
Dynamic base pointer or time reference for secondary time interval ct Strategy Development 11 06-20-2007 02:27 PM


All times are GMT -6. The time now is 03:21 PM.