Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Inconsistent Bars.BarsSinceNewTradingDay

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

    Inconsistent Bars.BarsSinceNewTradingDay

    Hello,

    If I print the Bars.BarsSinceNewTradingDay at Bars.IsLastBarOfSession I can see the number of bars are not consistent. Even if the Session Close Time is the same, the # of bars per session are not consistent. I see this with Second based bars. So why is this happening? Thanks for your help.

    #2
    I'm seeing the same thing , bar closed and open not same point. all of a sudden new bar appears and its Simms to be a complete mess.

    Comment


      #3
      Hello roblogic,

      That would depend on the available market data for the instrument. At 1 second granularity you may have times where there was no trades during that 1 second so that would cause a varied number of bars per session. You wont see bars when there are no trades as there would be no volume to or prices to plot. I would suggest trying a much larger timeframe like 5 minute bars to see if that is more consistent as you would generally see that there is always some trades happening during each 5 minutes of time so a bar would be generated.

      Comment


        #4
        Thanks Jesse. That makes sense and increasing the granularity it does indeed reduce the inconsistency. I would like however a bar type that it calls OnBarUpdate every X seconds (or unit of time) irrespective of the market data. So if there was no new market data it will still call and create the bar with the exact High Open Low Close of the previous bar, so there will be always the same number of bars per session as long as the session closing time remains consistent. Are you aware of a bar type with these characteristics, or could any of the built-in time bars be modified to achieve such functionality? Thank you!.

        Comment


          #5
          Hello roblogic,

          Unfortunately that wouldn't be possible because of how bars types work. If there is physically no data for a time period then the bars type core method OnDataPoint is not called so there is no bar for that time period. When the OnDataPoint is called it uses the time from the data point to assign it to either a new bar or an existing bar depending on the timestamp. If a new bar is generated then the new data point timestamp is used and if there is time between the last bar there will be a gap between bar times.

          The only way to achieve that would be to modify the historical data and re import it. You could generate data that has a timestamp for every second and 1 volume for that timestamp if not already existing so it makes a bar but the realtime bars won't work like that.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          63 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X