Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions about TradingHours and GetBar

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

    Questions about TradingHours and GetBar

    Hey guys,

    I'm creating an indicator that uses "TradingHours" and "BarsArray[0].GetBar".
    I have two questions.

    First:
    Which instrument typically uses the following TradingHours?

    (01) ASX Index Futures
    (02) ASX Interest Rate
    (03) CBOT Agriculturals Mini ETH
    (04) CBOT Agriculturals Mini RTH
    (05) CFD AUS
    (06) CFD HKG
    (07) China A Share Market
    (08) China Futures Night Off
    (09) China Futures Night_0100
    (10) China Futures Night_0230
    (11) China Futures Night_2300
    (12) China Futures Night_2330
    (13) China Index Futures
    (14) CME Forest Futures
    (15) CME Forest Futures ETH
    (16) HKFE
    (17) Ipe Europe Futures
    (18) KLSE
    (19) Ose
    (20) Ose Nikkei Mini
    (21) SGX CNX Index Futures ETH2
    (22) SGX Interest Rate
    (23) Tocom

    (I need to do some debugging).

    Second:
    What happens when we use "BarsArray[0].GetBar" to produce the "absolute index"? Will a time in the future always have a bar? My indicator runs with time chart, can I expect to always have a bar when using "GetBar" if the bar is in the future? What happens to the differences in minutes that the DateTime variable can have with respect to the time of the bars that is based on a specific interval? Is it possible to see the code of the "GetBar" method?

    Thanks​

    #2
    Hello rafaelcoisa,

    Thank you for your post.

    For your first question, we do not have a list of instruments that uses each trading hours template. What you could do is go to Control Center > Tools > Instruments. Next, select different instruments that you would like to check and review what Trading Hours template is used by each instrument that you check. That should help to understand which instruments are using which trading hours template in their instrument settings. For more details on the Instruments and Trading Hours windows:For your second question, please refer to the note on the GetBar() page of the help guide:
    • https://ninjatrader.com/support/help...nt8/getbar.htm
      • "Note: If the time parameter provided is older than the first bar in the series, a bar index of 0 is returned. If the time stamp is newer than the last bar in the series, the last absolute bar index is returned."
    This means that a time in the future will always return the last absolute bar index. You may test this by adding print statements into your script and use a time in the future on purpose in order to review what happens.
    "What happens to the differences in minutes that the DateTime variable can have with respect to the time of the bars that is based on a specific interval?" I'm not sure that I fully understand this question; are you able to provide a snippet of code demonstrating what you are referring to?

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    338 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X