Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBar value when opening Sunday evening?

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

    CurrentBar value when opening Sunday evening?

    NT8
    I have been testing using Playback Connection, DataSet has tick replay enabled.
    When I select an instrument and the Start Date in the Playback controller, it starts the day at midnight, and the first bar has CurrentBar index value of 0.
    Example: This occurs for Mar 14, 2023, and I do have market replay data downloaded for Mar 13, 2023, but that historical data is not displayed on the chart.


    I am asking when I would be using a live connection to real time market data, and I open a chart and data connection on Sunday evening market open time, i.e. 6 pm new york time, would the chart populate with historical data from the previous trading day (Friday) , note: Data Series, Time Frame, Load data based on Days, 3

    ? - Is the first bar starting Sunday going to have a CurrentBar value of 0, or will it use all the historical bars in the Data Series, and have a CurrentBar value greater than 0 ?

    ? - If I have a SMA indicator using a 14 bar lookback, on the first bar from the Sunday open, will that SMA use the 13 barsAgo from Friday's historical data, or do I need to wait until 14 bars have been created starting from Sunday's open time?

    I have only 1 BarsArray.
    I think I understand that I could use Bars.BarsSinceNewTradingDay to get the count of the quantity of bars from the start of the current session.

    Sorry if this is a dumb question, I'm feeling dopey this morning...

    #2
    Hello balltrader,

    Thanks for your post.

    If you were to open a realtime chart on a Sunday evening market open time, say 04/23/2023 for this example, and you have the Days to Load property set to 3, there will be 3 days of historical data prior to Sunday 04/23/2023 loaded on the chart.

    This means that yes, the chart would populate with historical data from the previous trading day (Friday 04/21/2023 in this example).

    Since the first bar on the chart is not for Sunday, bar 0 on the chart would not be the first bar starting Sunday. Bar 0 would be the start of the session 3 days prior to Sunday.

    This means the SMA indicator would look back 14 bars back from Sunday's open bar since that historical data is loaded on the chart. You would not need to wait until 14 bars have been created on Sunday if there are 14 bars of historical data loaded on the chart prior to Sunday.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Yes, CurrentBar will be greater than zero because of all the previous historical days. Yes, SMA on the Sunday open will include data from Friday (or further back, depending if the length goes back further).
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      41 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      64 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X