Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[] does not match GetTime on Daily or higher timeframes

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

    Time[] does not match GetTime on Daily or higher timeframes

    Hello,
    I'm trying to get the timestamp for daily bars, but it seems the GetTime function return the previous day date but not the current.
    The sample code:
    Code:
    .....
    Calculate									= Calculate.OnEachTick;
    ....
    
    protected override void OnBarUpdate()
    		{
    			DateTime time = Bars.GetTime(CurrentBar);
    			Print(String.Format("CurrentBar={0}, Time[0]={1}, GetTime={2}", CurrentBar, Time[0], time));
    		}
    Here is what it prints on 1 Day chart


    on intraday timeframes the Time[0] matches the result of GetTime function, but on daily chart of higher this values doesn't match. Is there any workaround?
    Thank you!
    Last edited by serialbug; 09-12-2016, 06:25 AM.

    #2
    Hello serialbug,

    Thank you for your post.

    For formatting purposes, the value returned is NOT guaranteed be equal to the TimeSeries value. If you are using daily bars and need the session end time, you should use Bars.GetSessionEndTime() instead.
    You can find information on GetTime at the following link: http://ninjatrader.com/support/helpG...us/gettime.htm

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    48 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    30 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    99 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    177 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    170 views
    0 likes
    Last Post CarlTrading  
    Working...
    X