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 kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    24 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    14 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    135 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X