• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last candle of the session plotted after the session break.

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

    Last candle of the session plotted after the session break.

    Opening a simple multi bar series chart with NinjaTrader 8.0.5.2

    First bar series is a 500 tick chart for CL 05-17.

    Second bar series is a 5 min chart for CL 05-17.

    Just a default chart, no template.


    Why is the last 5-min candle for CL 05-17 that represents the close of the trading day plotted after the session break?
    Attached Files

    #2
    Harry, thank you for your post.

    This is because Equidistant bar spacing is enabled which enables plotting bars at an equal distance from each other (as closely as possible because of tick charts aren't based on time). In addition, I tested this on my end and see the same, however, the first bar does show the time of the open at 12:00 AM on the minute chart. If you enable the Data Box and hover your mouse over the first bar after the session break line, what time does it show? To enable the data box, right-click on the chart and click to enable Show Data Box. Next, hover your mouse over the first bar which shows the time in the Data Box.

    In addition, you may disable equidistant bar spacing which would sort the bars to the time chart you have and would put the tick bars in accordance to the minute chart. To disable, right-click on your chart and select Properties. In the Properties window, uncheck Equidistant bar spacing and click OK.

    I look forward to seeing your next post.
    Riley S.NinjaTrader Customer Service

    Comment


      #3
      If you look at the chart that I have posted, you can clearly make out that the green bar is the 11:00 PM candle.

      The lower chart is a 5 min chart, and you will notice the other candles at times 22:45, 22:50, 22:55 which are correctly plotted.

      The last candle of the session is the 23:00 (11:00 PM) candle. The session for CL 05-17 closes at 11:00 PM (5:00 PM EST).

      -> The session break line is correctly drawn at 11:00 PM.
      -> For the primary bars the last red candle has a time stamp of 22:59:59 (data box)
      -> The green candle for the secondary bars plots at 23:00:00 (data box)

      The screenshot below shows the cursor (crosshair mode) that display the time 22:59:59 for the green bar that follows the session break.

      The green bar sits in the new session that starts at 12:00 AM. However the green bar should be the closing bar of the session that ends at 11:00 PM.


      Problem

      The problem here is that the session break line on the chart is determined by the primary bars. As the primary bars are built from ticks, the session break line would be plotted at 22:59:59. The time stamp 23:00:00 would already belong to the new session for tick bars.

      However, if bars are time-based such as minute bars, the time stamp of 23:00:00 still belongs to the old session.

      The first chart attached shows that NinjaTrader closes the session at 22:59:59 and therefore erroneously puts the 23:00:00 5-minute bar into the next trading day.

      Solution

      NinjaTrader should take into account both primary bar series and secondary bar series for drawing a session break. When one of the bar series is timebased, the session break should be drawn at the full hour, otherwise it can be drawn 1 second earlier.

      By the way when you select the minute bars as primary bars, but the tick bars as secondary bars, the chart is correct. The session break is now based on the time based bars. Therefore the session now includes the last bar of the trading day that plotted at 11:00 PM. This is shown for the second chart.

      This confirms that the problem arises because the session break is only based on the primary bars and therefore misplaced.
      Attached Files

      Comment


        #4
        Harry, thank you for your post back.

        I am able to reproduce this exactly and will submit a report to our Quality Assurance team for further testing--thanks again for providing me with many details.

        I would like to add, if you disable Equidistant bar spacing, 11:00 PM bar will plot on the session break line for the time interval regardless of the first data series' interval that you have selected.
        Riley S.NinjaTrader Customer Service

        Comment


          #5
          I know that it shows correctly with non-equidistant bar spacing (linear time spacing). The problem only arises

          -> when the chart is set to multi-equidistant bar spacing
          -> when the primary bars are bars built from ticks (session break 1 second earlier)
          -> when any of the secondary bars are time based

          Only in this case the last bar of the time based bars will plot outside the session breakline imposed by the primary bars built from ticks.

          It is not an important issue, but nevertheless it is an issue, which can be fixed by displacing the session break line by one bar to include the last time-based bar with the session to which it belongs.

          Comment


            #6
            Harry, I have an update.

            After testing this further, I found that the session break line will plot on the last bar on tick intervals and the same goes for time-based intervals as well. For example, the last tick for the bar that you report at around 11:00 PM on tick based intervals is at 22:59:59 which is where the session break line would be plotted, and for the time-based interval at 23:00.

            Testing this further, I found if you don't have the same trading hours template applied to both data series you have in the chart, then both session break lines will plot at different areas of your chart, however, setting both to the same template, you should see two session break lines: one at 22:59 from the tick chart and the other at 23:00. To do this, navigate to the Chart, right-click and select Data Series. In the Data Series window, select the second instrument in the Applied field and ensure that it's set to the same Trading hours template that you have applied to the first instrument.

            Please let me know your thoughts on this as your feedback is greatly appreciated.
            Riley S.NinjaTrader Customer Service

            Comment


              #7
              I have applied the same trading hours template in the chart for both bar series. Both bar series are set to instrument settings.

              The problem here is that for a tick based bar series NinjaTrader will set the session end to 22:59:59 (milliseconds truncated), whereas for a time-based bar series NinjaTrader will set the session end to 23:00:00. This is a design feature for NinjaTrader. NinjaTrader will create different session start and end times from the same trading hours template depending on whether the bar series is built from ticks or whether it is time based. You will easily find this confirmed by looking at the NinjaScript methods GetNextSession() and CalculateTradingDay() which will include or not include the end time stamp of the session.

              For the chart that I have posted twice NinjaTrader determines the session break by using the trading hours for the first bar series which is set to 22:59:59 (milliseconds truncated). This session break is then applied erroneously to the secondary bars as well. However, as the secondary bars are timebased the 23:00:00 candle is now visually excluded from the session where it belongs.

              All that needs to be done here is check both bar series for the session end time that is applicable, and then select the end time stamp from the time-based bars for displaying the session break.
              Last edited by Harry; 03-30-2017, 12:08 PM.

              Comment


                #8
                Riley,

                You are correct. The chart shows two session break lines for both bar series.

                I simply did not see the second session break line, because it had the same color as the session grid lines.

                Also I did not expect to see two different session break lines, when applying the same trading hours template to two bar series.

                Therefore I did not watch out for a second session break line!

                The chart below shows both session break lines (color of the second break line changed). It looks a bit odd, but is technically correct.
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Hanstanz, Today, 04:44 AM
                0 responses
                2 views
                0 likes
                Last Post Hanstanz  
                Started by juniortut, Today, 04:38 AM
                0 responses
                1 view
                0 likes
                Last Post juniortut  
                Started by rojiinko, Today, 03:58 AM
                0 responses
                1 view
                0 likes
                Last Post rojiinko  
                Started by mreanuzlazx, Today, 01:30 AM
                0 responses
                1 view
                0 likes
                Last Post mreanuzlazx  
                Started by xinepev, Today, 12:33 AM
                0 responses
                4 views
                0 likes
                Last Post xinepev
                by xinepev
                 
                Working...
                X