Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange end of session time for partial holidays in multi dataseries strategy

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

    Strange end of session time for partial holidays in multi dataseries strategy

    Hello,

    Running Ninjatrader 8.0.23.2 64-bit Multi-Broker

    I am backtesting a strategy dealing with 2 granularities of the same instrument. I have:
    BarsInProgress = 0 : CL 02-21 Last at 1440minutes with Trading Hours set to 9:15am till 8pm Paris time <--- to get my signal
    BarsInProgress = 1 : CL 02-21 Last at 1minute with Trading Hours set to 9am till 8:15pm Paris time <---- to execute the orders and manage trades

    On a partial holiday (like 21 jan 2019) the market closes early (7pm Paris time) so I have set 7pm Paris time in both my Trading Hours objects for that day
    I also checked my historical data and I have minute bars downloaded until 7pm on 21 Jan 2019. So all is good.

    When I run my strategy in the analyzer with "Break at EOD = True", on that special day, the OnBarUpdate event with BarsInProgress=0 is called at Times[0][0] = 21/1/2019 13:00 !!! instead of 19:00. On the other days it happens at 20:00 as expected.

    Nowhere in my settings there is 1pm anywhere. This happens on every PartialHolidays only, my understanding is that something special is done on PartialHolidays and the EOD check may be done on the trading hours of the master instrument and not the trading hours or something like that, or a confusion in timezone. This 1pm OnBarUpdate really puzzles me and makes my results wrong.

    could you help me figure out what is going on there ?

    thanks in advance.

    Guillaume

    #2
    Hello Guillaume,

    Welcome to the NinjaTrader forums!

    When adding a series, are you specifying the isResetOnNewTradingDay parameter?

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

    Do you have a simple test script with just this code printing the bar values that are unexpected I may test?


    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm

    (edit, apologies was looking at the wrong year)
    Last edited by NinjaTrader_ChelseaB; 12-22-2020, 04:06 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the feed back.

      indeed I have isResetOnNewTradingDay as True but I need it so it breaks at 20:15 according to my Special trading hours.
      I have compiled a very simple strategy to demonstrate what I mean. It is in the zip file as you explain. I have added my 2 TradingHours templates that you will need to have the special hours and partial holidays.
      you also need to be on timezone Paris if you want to get the same settings as me.

      this really looks like it is taking the TradingHours object from the master instrument (which has a closing at 1pm on that day) and not from the dataseries I have loaded.

      let me know
      Guillaume
      Attached Files

      Comment


        #4
        I forgot to add also the settings with which I run the strategy analyzer. I double checked everything and there is no 1pm anywhere in my setup. So I guess I dont get how this all work..

        Comment


          #5
          Hello guillaumv,

          Thank you for clarifying that you are using a custom Trading hours template.

          If you print BarsArray[1].TradingHours.Name in State.DataLoaded, what prints in the output window?

          I'm printing and finding the 1440 minute bar close lines up exactly with the selected Trading Hours template.
          Code:
          In OnStateChange():
          else if (State == State.Configure)
          {
              AddDataSeries(null, new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440}, "CME US Index Futures ETH", false);
          }
          else if (State == State.DataLoaded)
          {
              ClearOutputWindow();
          
              for (int index = 0; index < BarsArray.Count(); index++)
                  Print(string.Format("BarsArray[{0}] EOD: {1}, {2}", index, BarsArray[index].IsResetOnNewTradingDay, BarsArray[1].TradingHours.Name));
          }
          
          In OnBarUpdate():
          if (BarsInProgress == 1)
          {
          Print(string.Format("{0} | BIP: {1}", Time[0], BarsInProgress));
          }
          Last edited by NinjaTrader_ChelseaB; 12-23-2020, 10:03 AM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Well, I have renammed my Trading Hours templates and restarted NinjaTrader and now the issue is gone. Before I had modified the hours but not changed the name so the old definition was still in the workspace I guess. Changing the name has forced NT to reload it, but I would think it should reload it when changes are done or on NT startup.
            Thanks for your help. the issue is resolved and there is nothing wrong with NT .

            How can I manually tell NT to reload its definitions of Trading Hours since a restart isnt enough?

            Comment


              #7
              Hello guillaumv,

              If the Trading Hours are changed, you need to reload all historical data. Right-click the chart -> select Reload All Historical Data. This is also true for any changes to instrument settings like rollover dates.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Brevo, Today, 01:45 AM
              0 responses
              4 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              3 views
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              241 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              384 views
              1 like
              Last Post Gavini
              by Gavini
               
              Started by oviejo, Today, 12:28 AM
              0 responses
              6 views
              0 likes
              Last Post oviejo
              by oviejo
               
              Working...
              X