Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

8.0.0.7 IsLastBarofSession

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

    8.0.0.7 IsLastBarofSession

    Hello Support,

    When I accessed to the last bar of session of BarsInProgress(1), 30000(3am) was returned. 60000(6am) is correct. The sample script and screenshots are attached.

    My PC timezone: Tokyo
    BarsInProgress = 0 and trading hours: Nikkei 225 index futures 1m, OSE Nikkie mini
    BarsInProgress = 1 and trading hours: DJIA, US Equities RTH

    Regards,
    Takeo
    Attached Files
    Last edited by tradertakeo; 07-17-2016, 02:23 AM.

    #2
    Hello Takeo,

    I have attached a simple script that prints the time of the bar that is the last bar of the session and has no other code.

    Please add this script to a chart using the session template of your choice. Ensure that the vertical session marker is viable on the chart. Then please scroll on the chart to the last bar of the previous session. Open the data box and place the mouse on that bar. Hit the Alt key on the keyboard to stop the mouse where it is, and then take a screenshot with the databox showing the time of the last bar of the session with the session marker visible on the chart.

    Also attach the output from the script.

    Below is a link to a video that demonstrates what I am looking for.
    http://screencast.com/t/SjjygJPevtbi
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB,

      Two files are attached.

      Takeo
      Attached Files

      Comment


        #4
        Hello Takeo,

        I have compared the output to the screenshot. Both are showing 6:00 AM.

        Is this behaving differently in real-time than it is historically?

        Is this incorrect?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea,

          This issue occurs when you use Nikkei 225(3am in tokyo time is the second session end time) as the data series 1(barinprogress 1) and DJIA(or any other US instruments) as the data series 2(barinprogress 2) . As we tested above, if DJIA is the first data series, IsLastBarofSession returns 6am, which is correct.

          Takeo

          Comment


            #6
            Hello Takeo,

            I have modified the script to use add a secondary series.

            I am still unable to reproduce the issue.

            Please import this modified strategy.

            Then change line 54 to add the Nikkei 225 using the correct symbol name.

            Then please send the output and the chart with the data series box open and the mouse on the bar of the session close as you have done before.

            Below is a link to a video I have created to demonstrate.

            http://screencast.com/t/del7kF8mCkx
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea,

              CaseA: ES&N225 NinjaScript Output...txt
              Data series 1 is ES and data series 2 is N225

              CaseB: N225&ES NinjaScript Output...txt
              Data series 1 is N225 and data series 2 is ES

              In CaseB, the session end time of N225 seems to be used for ES.

              Takeo
              Attached Files

              Comment


                #8
                Attached is the 1m N225 03-16 data for the last one month exported from my NT8. Hopefully it helps your testing.
                Attached Files

                Comment


                  #9
                  Hello Takeo,

                  Thank you for your patience while I inquired with development about this behavior.

                  In NinjaTrader 8, there is an addition of the TradingHours overload property. AddDataSeries, when this overload is not used, will default to the session template of the primary series. When used, this will load the session template of your choice and properly allow BarsArray[1].IsLastBarOfSession to return on the proper bar.

                  You can also find the trading hours of an instrument using Instrument.GetInstrument().
                  For example:
                  Code:
                  string SecondInstrument = "ES 03-16";
                  
                  AddDataSeries(SecondInstrument, new BarsPeriod() { BarsPeriodType = BarsPeriodType.Minute, Value = 1 }, [B]Instrument.GetInstrument(SecondInstrument).MasterInstrument.TradingHours.Name[/B] );
                  AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
                  http://ninjatrader.com/support/helpG...dataseries.htm

                  Attached is an example script to demonstrate.
                  Attached Files
                  Last edited by NinjaTrader_ChelseaB; 01-11-2016, 04:17 PM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Hello Chelsea,

                    Thank you very much for the proper solution and example! The tradingHoursName parameter works perfect as I expected. I can't wait finally to translate all my strategies into NT8 and run them on IB gateway!

                    Takeo

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by judysamnt7, 03-13-2023, 09:11 AM
                    4 responses
                    55 views
                    0 likes
                    Last Post DynamicTest  
                    Started by ScottWalsh, Today, 06:52 PM
                    4 responses
                    35 views
                    0 likes
                    Last Post ScottWalsh  
                    Started by olisav57, Today, 07:39 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post olisav57  
                    Started by trilliantrader, Today, 03:01 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post helpwanted  
                    Started by cre8able, Today, 07:24 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post cre8able  
                    Working...
                    X