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

Order of time frames arbitrary?

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

    Order of time frames arbitrary?

    Hello,

    when using Add() method for MTF Systems, is there a mandatory order like smaller to higher time frames or vice versa? Or is it completely irrelevant?

    I reckon that the Chart sets the first time Frame and Instrument, but for the rest I would like to know any constraint / recommendation.

    Basically, I plan to use e.g. 1 hour bid chart to set the first Price series, and add in the strategy 1 hour ask series.
    Further, in backtest mode I will add 1 Minute bid and ask series for Position Management, and in live mode replace those by bid and ask tick series for the same purpose.

    Is this a good concept?

    Thanks,
    Martin

    #2
    Hello Martin,

    Thank you for your post.

    There is no proper order, but which ever is added first will receive the bar series index first. I see no issue with the idea you have presented. You can view the information available on multiple time series and instruments at the following link: http://www.ninjatrader.com/support/h...nstruments.htm

    Please let me know if you have any questions.

    Comment


      #3
      Thank you, Patrick.

      Further to what you wrote, I need to know:

      1. According to the documentation you pointed me to, the order of bar Events in backtests is as subscribed to using the Add() method, i.e. it will Loop through the BarArray sequentially.
      Is this order arbitrary in live mode, or does the platform sync to the same order as it is executed in backtest? In other words, is there a guaranteed order in live mode? I Need to know this for Synchronisation of entry order conditions across plural time Frames.

      2. There is apparently no way to backtest indicators of multiple time Frames with intra-bar upates, since the higher time Frames can only reference back the last closed bar, while in live mode, I can do this. Or is there any fancy example of using 1 Minute data in a multiple bar series Fashion to simulate intra-bar indicator updates in backtest mode? I could theoretically track high, low, open and Close intrabar values myself, but I am not sure how to pass this to the higher time Frame indicator to force an intra-bar update.

      Best regards,
      Martin

      Comment


        #4
        Martin,

        There is no guaranteed order. The Bar updates will get processed when the close of the bar is detected and OnBarUpdate is called for that particular bar series. However, if you run the strategy with CalculateOnBarClose set to false, this becomes irrelevant as all your bar objects would get called at the same time.

        Yes, you would need to use intrabar granularity to the strategy.
        We have an example of this available at the link below -
        http://www.ninjatrader.com/support/f...ead.php?t=6652
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Thanks again.

          Strictly speaking, the tick based processing you mention here

          However, if you run the strategy with CalculateOnBarClose set to false, this becomes irrelevant as all your bar objects would get called at the same time.
          Above I understand for different time Frames of one Instrument. In that case, is BarsInProgress not being set at all for a programmatic check? How would I know that a new bar of different time Frames has opened?

          For the second question, I guess I was not clear. Your example is a fast order execution based on an entry condition from a higher time Frame. This is all fine.

          What I meant is following:
          In a tick based strategy, I could apparently update an indicator intrabar, e.g. I have a H1 MACD and a H4 MACD. A H1 bar Close has occurred, so I could in live mode also update the H4 MACD intrabar values at that Point. In Backtest mode, this seems not be feasible, since there is no OHLC data available for the H4 bar being built up to that Point in time. Any work-around?

          Best regards,
          Martin

          Comment


            #6
            Martin,

            What do you mean by not being set at all for programmatic check?

            If you want to know when a new bar is created in a different timeframe using COBC set to false you would want to check for FirstTickOfBar. This will get called when a new bar is created.

            No, there is no work around for this.
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              I mean that with COBC set to false, still having multiple different time Frames of the same Instrument added using Add(), is BarsInProgress working together with FirstTickOfBar to correctly indicate all bars having closed at that tick?
              Example, I subscribe to 1H and 4H bars, set COBC to false. So, would FirstTickOfBar indicate the distinct Events of 1H bar Close not having a 4H bar Close, and also indicate 1H and 4H bars Close every 4 hours, which I would check by the combination of BarsInProgress and FirstTickOfBar in OnBarUpdate() method.

              Thanks for your help,
              Martin

              Comment


                #8
                Martin,

                Yes the FirstTickOfBar will work with the BarsInProgress to which one is having that new bar created.
                Cal H.NinjaTrader Customer Service

                Comment


                  #9
                  Great!

                  Thanks for your help.

                  Cheers,
                  Martin

                  Comment


                    #10
                    Actually, I forgot to mention that a work-around for the backtesting is possible for the intra-bar updates of indicators. It is some work to program it, but I have done it alreary on other platform and it works well, just Need to construct High, Low, actual Price from a lower time Frame for an intra-bar of a higher time Frame and feed These values to an indicator formula being used from within the strategy. Not nice, but possible, and it is only required in rare cases.

                    Cheers,
                    Martin

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cshox, Today, 11:11 AM
                    0 responses
                    0 views
                    0 likes
                    Last Post cshox
                    by cshox
                     
                    Started by TAJTrades, Today, 11:03 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post TAJTrades  
                    Started by wuannetraam, Today, 02:40 AM
                    3 responses
                    25 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by jjs12, Today, 10:29 AM
                    2 responses
                    12 views
                    0 likes
                    Last Post jjs12
                    by jjs12
                     
                    Started by Ludwik, Today, 03:52 AM
                    7 responses
                    32 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X