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!
See more
See less

Partner 728x90

Collapse

OnBarUpdate Time[0] is not updated real time with minute bars

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    3 responses
    47 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X