Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Break at EOD Broken & Barcount Off

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

    Break at EOD Broken & Barcount Off

    So I've noticed for a while odd behavior in the bar counts and how Break at EOD is suppose to work. One of my strategies sends periodic text alerts at market open and each hour on the hour to my phone but I found that I couldn't reliably get the 4pm market close message to always send. I had since found ways around it as my actual trading strategies had my attention more than the simple message alerts but recently I decided to investigate it more.

    NT v8.0.7.1, Kinetick data, IB Gateway 960.2g

    What I found:
    1) Break at EOD doesn't seem to work at all
    2) The 3:59pm to 4:00pm bar always seems to process on the next day
    3) Because of item 2 bar #389 will show as real time when in fact it is not & always making bar #388 the last bar of session instead of #389
    4) Days to preload appears to not follow the Trading Hours template for US Equities RTH

    Attachments:
    IBM - BarCount - Monday.csv (Shows how when Days to Load is set to 1 but the strategy starts on a Monday it doesn't load the last Friday's data but nothing instead since Sunday had no bars)
    IBM - BarCount - Tuesday.csv (Shows the result of NOT USING Break at EOD & at how the 4pm bar from Monday is processed as realtime on Tuesday)
    IBM - BarCount - Wednesday.csv (Shows the result of USING Break at EOD & at how the 4pm bar from Tuesday is process as realtime on Wednesday)
    BarCountTest.zip (Is the strategy created to verify these issues and output the CSV files)

    CSV File Layout:
    [BarDateTime] [Bar State] [Current Bar #] [Bar Type] [Data Type] [Bar # Since Start] [Actual PC Time] [Break at EOD T/F]

    So is it just me or am I mis-understanding how these items work?
    Thanks,
    Attached Files
    Last edited by antrux; 07-22-2017, 09:01 AM.

    #2
    Hello antrux,

    This is expected behavior.

    A bar does not close and trigger OnBarUpdate until a new bar has started forming (or a tick is received after the time of the close of that bar).

    I would recommend triggering an action before the close of the bar using real-time tick data if you are wanting events near the close of a session. (instead of waiting until after the session closes and the new session has opened)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Makes sense.

      Can you look at the EOD day issue too?
      Can you look at how yesterday's last bar shows as Realtime today too?
      Can you look at how days to preload doesn't follow Trading Hours templates too?

      Comment


        #4
        Hello antrux,

        I am not able to reproduce this behavior.

        On your chart you have Break at EOD checked but no session line is appearing on the chart at the end of the session?

        Attached is a screenshot showing the session break line on a chart with US Equities RTH at 4:00 PM Eastern which is expected.

        Can you provide a screenshot of your data series window and the chart to show this line is not appearing?


        Regarding the bar processed as real-time, to confirm you are adding or enabling the script after the start of a session and you are printing the value of State with the time of that bar and the state on that bar is showing as Realtime, is this correct?
        The bar is not the last bar on the chart which has not yet closed, but the bar before it, is this correct?
        I am not able to reproduce this behavior either. On my end, the currently building bar that has not closed is the first bar that is marked as real-time.

        Also, shown in the screenshot is that the previous session is closed at 4:00 PM Eastern and is respecting the trading hour template.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          No strategies are running on a chart but from the Strategies Tab. This is not a visual on the chart issue but a data issue as to what OnBarUpdate runs on.

          I attached code which outputs a CSV file and example outputs showing this. These attachments are on the original posting. As for time the strategy starts a little after 7am EST so it's waiting for market data to start flowing before the market is open.

          Comment


            #6
            Hi antrux,

            You are saying that IsResetOnNewTradingDays[0] is false in your output and this is unexpected because it is enabled in the Data Series parameters, is this correct?

            I am unable to reproduce this behavior.

            Are you running this in real-time, replay, or in the Strategy Analyzer?

            Do you have Break on EOD checked in the Data Series parameters?

            Can you provide a screenshot showing the Data Series parameters so that we may see you have this checked and enabled?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              IsResetOnNewTradingDays:
              A bool[]when true, indicates the specified BarsArray is setup to run Break at EOD; otherwise false.

              If Break at EOD is unchecked then this is false & if it is enabled then this is true.
              I added this to the strategy, attached, so that support could see in fact that it was or was not enabled.

              Strategy is running in real time with Days to load option set to 1. Was run on IBM, Last, Minute, 1, with Calculate On Bar Close.

              In the CSV files above the Monday and Tuesday files have Break at EOD disabled.
              The CSV file above labeled Wednesday has Break at EOD enabled.

              I was using the two files, say Tuesday & Wednesday to compare and see what exactly Break at EOD was doing. There is no difference based on what I see.

              You mentioned you can't reproduce this. How did you test this on your end? Did you enable that strategy before market open with the settings mentioned from the Strategies Tab? If so will you post the csv file output that you had?

              Comment


                #8
                Hello antrux,

                I have created a video to demonstrate for you that I am getting a true when Break on EOD is checked and false when Break on EOD is unchecked.
                Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  ChelseaB thank you for the video however I think we are discussing two different points.
                  Yes you are correct as to how the IsResetOnNewTradingDays works.
                  I was just stating that I added that function to prove that Break at EOD was indeed disabled for IBM-Tuesday and was enabled for IBM-Wednesday.

                  My main concern was in looking at the output between the two to compare how Break at EOD works. My understanding is that Break at EOD enabled completes the last bar of the day a little earlier than say 60 seconds if running on 1 min data. So for example the last min of the day is only say 45 seconds long instead of 60 seconds long allowing for the last bar to process before 4pm. Then with EOD disabled the last bar is a full 60 seconds so then Ninjascript can't process that bar until the next day because it's reached the market close time.

                  If you compare lines 390-392 from each of the files above, Tuesday & Wednesday, you can see that there is no difference between the bar time and the PC time.

                  Also that on line 391 from both files that yesterdays last bar processes as realtime today instead of being Historical.

                  Comment


                    #10
                    I'm seeing the same thing.

                    Originally posted by antrux View Post
                    ChelseaB thank you for the video however I think we are discussing two different points.
                    Yes you are correct as to how the IsResetOnNewTradingDays works.
                    I was just stating that I added that function to prove that Break at EOD was indeed disabled for IBM-Tuesday and was enabled for IBM-Wednesday.

                    My main concern was in looking at the output between the two to compare how Break at EOD works. My understanding is that Break at EOD enabled completes the last bar of the day a little earlier than say 60 seconds if running on 1 min data. So for example the last min of the day is only say 45 seconds long instead of 60 seconds long allowing for the last bar to process before 4pm. Then with EOD disabled the last bar is a full 60 seconds so then Ninjascript can't process that bar until the next day because it's reached the market close time.

                    If you compare lines 390-392 from each of the files above, Tuesday & Wednesday, you can see that there is no difference between the bar time and the PC time.

                    Also that on line 391 from both files that yesterdays last bar processes as realtime today instead of being Historical.
                    Chelsea, I'm seeing the same behavior. I 'm not sure if you're understanding what antrux is trying to explain to you.

                    Comment


                      #11
                      Maybe this will get us on the same page since you refuse to look at any of the data that I have provided.
                      Attached Files

                      Comment


                        #12
                        Hello antrux,

                        I have viewed your cvs files from the first post. However, I am not clear on the issue.

                        When you mention
                        My understanding is that Break at EOD enabled completes the last bar of the day a little earlier than say 60 seconds if running on 1 min data.
                        Are you referring to the Exit on close for automated strategies?

                        The Break at the end of the session should occur on the bar close and not before. This checkbox is what causes the forming bar to close and the new bar to open, instead of being one continuous bar. This is not something that runs other actions in the background a few seconds before the close of the bar the way that Exit on close does.



                        It is expected that the last bar on the chart is the first real-time bar. If you are opening your chart before the start of a session, the last on bar on the chart is the currently building bar.
                        In a script, if we want a trigger on the last historical bar we use if (State == State.Historical && CurrentBar == Count - 2). The Count - 2 is because CurrentBar starts at 0 while Count starts at 1, and 1 more because the last bar on the chart is the first real-time bar not the last historical bar. This bar is not closed when the historical data loads and will close in real-time once a tick is received in real-time to close that bar and open a new bar.

                        I am not clear on what the issue is that you are referring to. In one sentence can you summarize the issue?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Understood, Break at EOD has no affect on bar time or bar processing only graphic indicators that may need it.

                          Ok, bar 389, the last bar from the previous day is suppose to process as Realtime the next day. Understood.

                          Last question that wasn't mentioned about.
                          Is Days to Load supposed to follow the Trading Hours schedule or not? Will weekend days always be counted as Days in the Days to Load function?

                          Comment


                            #14
                            Hello antrux,

                            No, days to load is calendar days, not days in the session template.

                            If your template has 5 days in a 7 day period because of a weekend and you load 7 days on monday, it will load back to the previous monday, not the thursday before the previous monday.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Ok so this is known/good behavior and shouldn't change then. Understood.

                              Thank you ChelseaB.
                              Joe
                              Last edited by antrux; 08-01-2017, 04:10 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by maybeimnotrader, Today, 05:46 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post maybeimnotrader  
                              Started by quantismo, Today, 05:13 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post quantismo  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              8 responses
                              166 views
                              0 likes
                              Last Post jeronymite  
                              Started by cre8able, Today, 04:22 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post cre8able  
                              Started by RichStudent, Today, 04:21 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post RichStudent  
                              Working...
                              X