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

Multi timeframe, some market data are not processed

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

    Multi timeframe, some market data are not processed

    Hello,

    I'm trying to make use of the multi timeframe capabilities of ninjatrader.

    However when running a strategy with two Bars series (the primary one in 1 day bars, and the secondary one in 60 min bars) I found out that some market data were not processed.

    I wrote a simple sample strat in order to expose the issue, attached it to this message.
    I ran it like this:
    • In the Strategy Analyzer
    • "Data Series" set to "Last", "Day", "1"
    • MinBarsRequired set to "0" (zero)
    • From 01/02/2015 to 05/02/2015

    Strategy output:
    Sample strat - OnStartUp
    02/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    03/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
    03/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    04/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
    04/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=1
    Sample strat - OnTermination
    As you can see BarsInProgress=0 appears for the first time on the bar timestamped 03/02/2015 22:00:00, which means that a complete bar is skipped (the 02/02/03 bar).

    As you can also see the BarsInProgress=1 apears for the first time on the bar timestamped 02/02/2015 22:00:00, which means that many bars were skipped (bars from 8 am to 21 pm on the 02/02/2015).

    I've checked the data is not "missing", it's just not processed by the strategy.

    Is it possible to backtest the period set in the strategy analyzer backtest window without NT skipping some data at the beginning?

    Thanks for the help
    Attached Files

    #2
    Hello automated,

    Thanks for your post and welcome to the NinjaTrader forums.

    Can you confirm that you intended to run this from Sunday February 1st 2015 to Thursday February 5th 2015?

    Also, as session may be a part of the answer, what instrument did you run your tests on and what time zone are you in.
    Last edited by NinjaTrader_PaulH; 02-02-2016, 01:01 PM.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      It looks like you edited your original message without leaving a hint of what you edited, and why you did. Let me tell you that this is not something you should do, specially if you use that to question me.

      You might not be aware of that, but when you edit your post I'm NOT notified of it, and therefore have no clue you changed your mind, nor that you are asking questions. You are free to amend your text before you post it, but not after. That's how communication works, once I read it you can't change the content of it without breaking the communication, I'm sure you can understand that. Btw this remark is not directed to you personally, but rather to NinjaTrader's support team as a whole.

      Luckily, I kept an eye on the thread (because I'm aware of that editing technique). Please next time reply to the post instead of editing that would be a better way of communicating.

      Your original post said something along "Alright I've confirmed your observations and filled a bug report".
      And now, you are asking about instrument name, session and timezone... I don't see the point. Since you reproduced the issue, why do you care about those things?

      Can you confirm that you intended to run this from Sunday February 1st 2015 to Thursday February 5th 2015?
      Yes, that's the dates I've set in the StrategyAnalyzer backtest window.

      Also, as session may be a part of the answer, what instrument did you run your tests on and what time zone are you in.
      Instrument is FESX ##-##, my timezone is CET.

      So back to the issue now.

      This is what happen when running the sample strategy (the one I sent yesterday) while commenting the line that adds the secondary Bars series, on a 1 day timeframe:

      Sample strat - OnStartUp
      02/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      Sample strat - OnTermination
      Now the same sample strategy on a 1 hour timeframe:
      Sample strat - OnStartUp
      02/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      02/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0

      03/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      03/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      04/02/2015 22:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 09:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 10:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 11:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 12:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 13:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 14:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 15:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 16:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 17:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 18:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 19:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 20:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      05/02/2015 21:00:00 - Sample strat - OnBarUpdate, BarsInProgress=0
      Sample strat - OnTermination
      Notice how data is processed here as of the 02/02/2015, on a daily or hourly timeframe. It's not working as expected only in the case (outlined yesterday in my first post) when a secondary Bars series is added in the strategy. All test use the same instrument, session, timezone, computer etc...

      Please, can you clearly state that you are able to reproduce this incorrect behaviour?

      PS: If by any chance any NT user has the time to try this on their end, I would be thankful to them for confirming this bug. Also I think it would be a good idea for NT8 beta users to try this while NT8 is still not released. Chances of getting it fixed are higher while it's still in beta.

      Comment


        #4
        Hello automated,

        Thank you for your response.

        I see this in NinjaTrader 7 as well. It is due to being unable to select a Session Template for the Daily bar and it using what ever is set by the provider.

        This is not the case in NinjaTrader8. I can see the values produced correctly as we can determine individual Session Templates for each bar series:
        2/1/2015 5:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 6:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 7:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 8:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 9:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 10:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/1/2015 11:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 12:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 1:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 2:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 3:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 4:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 5:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 6:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 7:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 8:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 9:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 10:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 11:00:00 AM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 12:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 1:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 2:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=1
        2/2/2015 3:00:00 PM - Sample strat - OnBarUpdate, BarsInProgress=0

        Comment


          #5
          Hello,

          Thanks for following up.
          It's good news it's working fine on NT8.

          Do you have any recommendation or workaround to (manually or programmatically) set the correct session template on NT7?

          Comment


            #6
            automated,

            You could use a 1440 Minute bar in place of the Daily bar.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kaywai, 09-01-2023, 08:44 PM
            5 responses
            601 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            6 responses
            22 views
            0 likes
            Last Post xiinteractive  
            Started by Pattontje, Yesterday, 02:10 PM
            2 responses
            18 views
            0 likes
            Last Post Pattontje  
            Started by flybuzz, 04-21-2024, 04:07 PM
            17 responses
            230 views
            0 likes
            Last Post TradingLoss  
            Started by agclub, 04-21-2024, 08:57 PM
            3 responses
            17 views
            0 likes
            Last Post TradingLoss  
            Working...
            X