How can I get the current time and not the time of the bar's close?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnBarUpdate Time[0] is not updated real time with minute bars
Collapse
X
-
OnBarUpdate Time[0] is not updated real time with minute bars
I just noticed this: when using minute bars & calculate on bar close = false, the Time[0] variable is always set to the value the minute bar will have when it closes. it's not updated real time. Is this by design?
How can I get the current time and not the time of the bar's close?Tags: None
-
Hello,
This is by design. NinjaTrader can only run on historical data on the close time stamps of the bars. As NinjaTrader knows no other data points of which to run from.
Therefor this is expected when running with Time[0] and especially expected with historical data.
However if your running a live only strategy(live data flowing in), you can get the system clock time in c# using DateTime.Now or any DateTime functions which are described on the MSDN microsoft coding page. This will not relate in any ways to your bars however it will simply get the current PC clock time and you can use this in some fashion.
Let me know if I can be of further assistance.BrettNinjaTrader Product Management
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
601 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
559 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
558 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment