No announcement yet.

Partner 728x90


Inconsistent "IsFirstBarOfSession"

  • Filter
  • Time
  • Show
Clear All
new posts

    Inconsistent "IsFirstBarOfSession"

    I have not reported this because I thought it was my issue...(still could be I suppose)....but occasionally I get inconsistent results when checking "IsFirstBarOfSession" and "Is LastBarOfSession".
    In the screen shots I have a regular CME Index Futures chart, using the standard Trading Hours RTH session. On once chart (looking back 120 days) I get both First & Last Bars of sessions right up to the end....but when I change the lookback period to (in this example) 33 days, I do not get the last IsFirstBarofSession and IsLastBarOfSession.

    The code is simple.....

    PHP Code:
    protected override void OnBarUpdate()
                if (
    Draw.Text(this,"fb"+CurrentBars[0],"IsFirstBarofSess",0,High[0]+(15 TickSize),false,"default");
                if (
    I have attached the actual code I used...( along with the screen shots.
    ....I did a 'reload' of historical data just before running this example, so I tend to think that the issue is not related to missing data. I also have been able to replicate this using different Trading Hours Templates....(I first noticed it on my 'custom' TH template that only inlcudes the European session (start 2am) and the standard Cash session. At the time I thought my session was set up incorrectly, but I can replicate this on the standard Ninja provided sessions.

    EDIT: almost forgot....the data feed is NinjaBroker
    Attached Files
    Last edited by photog53; 01-21-2016, 10:14 AM.

    Thank you for writing.

    I will be reviewing your code and this case. When I have additional details I will follow up here on this thread.


      I just noticed a few tidbits that might be helpful....

      The original chart that I used to 'create' my cache for the examples I submitted was a 120 day chart... When I create a second chart with fewer days is when I noticed the issue.

      The Chart DataSeries I was using when this occurred was a Second(450) chart....(in fact most of the times I remember this problem I was using something like a 60 second instead of a 1 minute.


        Thank for waiting.
        I was wondering if you could send me the settings for your Data Series because I am not getting the same results that is depicted in your screenshots. Also I would like to know what session are you having trouble with.

        I want to make sure you are using the NinjaTrader Continuum.

        I'll be waiting for your reply.


          Sorry....those answers are sort of buried in my earlier comments below

          using a ' 450 Second' dataseries (equivalent to 7 1/2 minutes)...although I get the same problem using a 60 second chart.

          I do not get this problem all the time..... and I can get past it by flushing cache and rebuilding.
          I don't encounter the problem all the time ....but....neither does it quite ever go away for good.

          ....also....resend my earlier comments
          The original chart that I used to 'create' my cache for the examples I submitted was a 120 day chart... When I create a second chart with fewer days is when I noticed the issue.


            Hello photog53,

            Thank you for replying back with some information that I requested.

            Upon testing everything that you have given me and tested a couple of times deleting the cache and reloading the historical data on a 120 day chart and an 33 day chart with different bar timers. I cannot produce the inconsistently between each chart. I did notice that both your screenshots were the same, but when I tested my time stamps were different from yours. I was wondering what session specifically were you using?

            I'll be waiting...


              I appreciate your effort.

              The Session I was using was the standard Ninja "CME US Index Futures RTH'.

              For what it's worth, I don't think there is anything 'magic' about the 120 versus 33 day lookback. I've had it happen on 15 day lookback and a 3 day name it....but it does not happen in such a way that I can reproduce it at will.
              Once it starts, I can then run the charts and flip back and forth, and the missing IsFirstBarOfSession will consistently not work on the chart that is a different 'lookback' from the lookback period on the chart the data was initially loaded under.

              The few discerning factors seem to be.....
              1. Original data gets loaded on a chart with a bigger lookback
              2. A subsequent (smaller lookback) chart is used and SOMETIMES the error occurs.
              3. It has only happened when I have using something other than 'minute' data...(in this case Seconds.

              Very strange....
              If I figure out how to replicate it at will, I'll send you another note.
              Last edited by photog53; 01-21-2016, 06:27 PM.


              Latest Posts


              Topics Statistics Last Post
              Started by WaveAtElliot, Today, 05:11 PM
              1 response
              1 like
              Last Post hdge4u
              by hdge4u
              Started by bosajin, Yesterday, 09:15 AM
              5 responses
              Last Post NinjaTrader_Jim  
              Started by Dolfan, Today, 12:24 PM
              4 responses
              Last Post NinjaTrader_Jim  
              Started by WeyldFalcon, Today, 11:09 AM
              7 responses
              Last Post WeyldFalcon  
              Started by DTSSTS, 08-10-2020, 09:48 AM
              12 responses
              Last Post DTSSTS
              by DTSSTS