Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

RTH Bars not Processing last day on chart

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

    RTH Bars not Processing last day on chart

    I have been working on a indicator to plot lines on an RTH session based upon values of the ETH overnight session. The indicator uses two DataSeries: one to hold the ETH data and one to hold RTH data. On the first bar of RTH, I need to plot these lines.


    I have found that the RTH data is not being processing bars on the last complete day. As a result, the RTH.IsFirstBarOfSession is not being set to true. In addition a SessioniIterator is returning stale session information.

    This problem is not related to historical data. If I have this on a chart at the time the RTH starts, the bar processing on the RTH DataSeries does not occur.


    I have constructed a simple test (see below) to demonstrate. Here are two excerpts from the same the test output:

    This is excerpt is working as expected. See how BarsInProgress shows all of the three DataSeries (0,1,2) are being processed.

    Start Bar: 8/29/2019 8:15:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 8:30:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 8:30:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 8:45:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 8:45:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 9:00:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 9:00:00 AM Bars In Progress: 2 ETH
    Start Bar: 8/29/2019 9:15:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 9:15:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 9:30:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 9:30:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 9:45:00 AM Bars In Progress: 0 <<<<< RTH start here
    Start Bar: 8/29/2019 9:45:00 AM Bars In Progress: 1
    Start Bar: 8/29/2019 9:45:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 10:00:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 10:00:00 AM Bars In Progress: 1
    Start Bar: 8/29/2019 10:00:00 AM Bars In Progress: 2 RTH
    Start Bar: 8/29/2019 10:15:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 10:15:00 AM Bars In Progress: 1
    Start Bar: 8/29/2019 10:15:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 10:30:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 10:30:00 AM Bars In Progress: 1
    Start Bar: 8/29/2019 10:30:00 AM Bars In Progress: 2
    Start Bar: 8/29/2019 10:45:00 AM Bars In Progress: 0
    Start Bar: 8/29/2019 10:45:00 AM Bars In Progress: 1
    Start Bar: 8/29/2019 10:45:00 AM Bars In Progress: 2



    The log excerpt below is NOT working as expected.

    Notice that BarsInProgress is only processing 0 (the default chart bars) and 2 (the ETH series). BarsInProgress 1 is never processed even after the RTH session begins.

    Start Bar: 8/30/2019 8:30:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 8:30:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 8:45:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 8:45:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 9:00:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 9:00:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 9:15:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 9:15:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 9:30:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 9:30:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 9:45:00 AM Bars In Progress: 0 <<<<< RTH start here
    Start Bar: 8/30/2019 9:45:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 10:00:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 10:00:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 10:15:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 10:15:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 10:30:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 10:30:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 10:45:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 10:45:00 AM Bars In Progress: 2
    Start Bar: 8/30/2019 11:00:00 AM Bars In Progress: 0
    Start Bar: 8/30/2019 11:00:00 AM Bars In Progress: 2


    How do I get the BarsInProgress to begin during the RTH session?


    Thank you.

    ================================================== ===============
    Indicator code that generated the above output.
    ================================================== ===============

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "VerifyBars";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    }
    else if (State == State.Configure)
    {
    AddDataSeries(Bars.Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriod.BarsPeriodType, Value = BarsPeriod.Value}, "CME US Index Futures RTH");
    AddDataSeries(Bars.Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = BarsPeriod.Value}, "CME US Index Futures ETH") ;

    }
    }

    protected override void OnBarUpdate()
    {
    //Add your custom indicator logic here.
    Print ("Bar: " + Time[0] + " Bars In Progress: " + BarsInProgress );

    //Bars In Progress:
    // 0 - Bars on visible Chart
    // 1- RTH Bars from DataSeries
    // 2- ETH Bars from DataSeries

    }
    }
    }

    Last edited by kweiss; 09-02-2019, 08:24 AM.

    #2
    Hello kweiss,

    Welcome to the forums!

    I'm just writing to let you know your message has been received and we will follow up with our findings.
    JimNinjaTrader Customer Service

    Comment


      #3
      Here is something else that is puzzling. I watched the indicator during the market open this morning (9/3/2019.) Notice that the BarsInProgress for the RTH session (1) was fired for yesterday. I would expect the bar to be process for the only the current day/time. After this, BarsInProgress has been working as expected -- processing the RTH for each bar.


      Start Bar: 9/3/2019 8:30:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 8:45:00 AM Bars In Progress: 0
      Start Bar: 9/3/2019 8:45:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 9:00:00 AM Bars In Progress: 0
      Start Bar: 9/3/2019 9:00:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 9:15:00 AM Bars In Progress: 0
      Start Bar: 9/3/2019 9:15:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 9:30:00 AM Bars In Progress: 0
      Start Bar: 9/2/2019 1:00:00 PM Bars In Progress: 1 <<<< Unexpected bar process from the prior day
      Start Bar: 9/3/2019 9:30:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 9:45:00 AM Bars In Progress: 0
      Start Bar: 9/3/2019 9:45:00 AM Bars In Progress: 1
      Start Bar: 9/3/2019 9:45:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 10:00:00 AM Bars In Progress: 0
      Start Bar: 9/3/2019 10:00:00 AM Bars In Progress: 1
      Start Bar: 9/3/2019 10:00:00 AM Bars In Progress: 2
      Start Bar: 9/3/2019 10:15:00 AM Bars In Progress: 0

      Comment


        #4
        Hello kweiss,

        I have attempted to set this up to reproduce the behavior and I am not seeing the same thing on my end.

        Could you have a look at the demonstration I linked below and provide me some clear steps so I can reproduce your results verbatim?



        Specifically I would like to know...
        • What data series/time frame I should be testing against
        • If I need to let this run on realtime data or if this can be seen with historical data when I should be refreshing the script for this test.
        • Any other specific steps I should take.
        Screenshots can help to convey how I should be testing.

        I look forward to investigating this further.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim - I am testing on ES 09-19 15 minute bars. Things appear to be working here also, however I still need to see the RTH start processing tomorrow morning. Things worked as expected today, except for the errant bar reported (see excerpt above.) That bar was the last bar of the prior session a day ago. Both unexpected events could be related. I have a suspicion that this is a Ninja Trader issue related to sessions ending before a holiday. Is it possible to set the date on your machine back 8/30 or 8/31 to see if the problem can be duplicated? Would you need to limit the number of bars on the chart to end on at 8/31 or 9/02? In any event, there is not more guidance I can give you as the indicator is as basic at it gets. If things continue to work, I will assume the gremlins invaded my machine and they have now moved on.

          Thanks for you help.

          Comment


            #6
            Hello kweiss,

            I will test those days with the Playback Connection to see if I can reproduce.

            It will be helpful if you checked as well so we can narrow the behavior down further and see if it is reproducible.

            I will be loading Market Replay data for that period of time and will use the Go To feature (Right Click > Go To) on the Playback Controller to skip ahead to a day where I can attempt to hit this behavior. After the day loads I will be opening a chart and adding the script to test.

            If you have any additional information you can advise me to hit the behavior, it will be much appreciated.

            If I am able to reproduce, I will update this thread.
            Last edited by NinjaTrader_Jim; 09-05-2019, 02:57 PM.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,229 views
            0 likes
            Last Post xiinteractive  
            Started by andrewtrades, Today, 04:57 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            7 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            441 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            12 views
            0 likes
            Last Post FAQtrader  
            Working...
            X