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!
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
NinjaTrader
DateTime.Now
Collapse
X
-
Hello,
Thank you for the question.
In NinjaTrader there is the ability to use c# standard DateTime.Now (computer time) or there is also the bars time or Time
If you are doing chart time comparisons you would want to use the Time object in NinjaTrader to ensure you are getting the correct times for the bar you are looking at.
The Current bars time in NinjaTrader is:
Code:Time[0]
Time is just a datetime object except it is a series which you can use a BarsAgo value with much like the rest of the Price data objects in NinjaScript.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Originally posted by FCatan View PostHi, I need to compare the current time (I'm assuming that's contained in DateTime.Now) to an integer field in the forma HHmmss (military format). How do I convert DateTime.Nowinto an integer to make that comparison. thank you!
Comment
-
Strategy delay by a couple of seconds
I see on session template that you cannot change the session to 09:30:04 for example... is there a way to do this in code?
if(ToTime(Time[0]) < 093004)
return;
doesnt work on my 390 minute chart based strategy.
Regards and thx for assistance.
Comment
-
Hello everington_f,
Thank you for your post.
There would not be a way to do this in the Session Manager. And when using Minute bars, the timestamp will always be to the minute.
You could add a 1 Tick series and then check against it. For example:
Code:if(ToTime(Times[1][0]) < 093004)
Comment
-
it was just an idea, I have a multi instrument strategy with ADD() 50 stocks... i just want to delay entry a couple of seconds until I am sure that all data is coming in..... i have found that if I fire it at 093000 some stocks trade as if it were yesterday... because the primary bar series is updating.. but other less liquid members of the list come on line a fraction later... and hence execute falsely.
Could i use
!Historical ? but how do i reference the bars in progress index for that?Last edited by elliot5; 07-10-2015, 10:05 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,607 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
9 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
19 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
6 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
15 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Comment