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

encapsulation of multiple timeframes

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

    encapsulation of multiple timeframes

    I have noticed that using multiple timeframes can get a bit tricky sometimes, so I would like to clarify something.
    Suppose I write a custom indicator Foo that uses multiple timeframes (say its input timeframe, plus 5min and 15min bars) internally. If I then use it inside a strategy (or another indicator) that runs only on 1min bars, will the strategy have any awareness or concern with the 5min and 15min bars, or be affected by them at all ? I think the answer is no, which means that the multi-timeframe messiness is confined to the Foo indicator. Please confirm this.
    Obviously the strategy is not going to be able to work until the Foo indicator gets enough bars (e.g. the 15min ones). Are there any other subtle effects (e.g. session templates) ?

    #2
    splat, your understanding is correct - the strategy would only deal with one series then and the MTF logic is confined to the Foo indicator in your example.



    For the second question, please see the notes section from the document above in the 'true event driven OnBarUpdate()' section.

    Notes:

    1. A multi-series script only processes bar update events from the primary Bars (the series the script is applied to) and any additional Bars objects the script adds itself. Additional Bars objects from a multi-series chart or from other multi-series scripts that may be running concurrently will not be processed by this multi-series script.

    2. If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the session template of the primary Bars object. If the primary Bars object is using the "<Use instrument settings>" session template then the additional Bars objects will use the default session templates as defined for their particular instruments in the Instrument Manager.

    3. In a multi-series script, real-time bar update events for a particular Bars object are only received when that Bars object has satisfied the BarsRequired requirement. To ensure you have satisfied the BarsRequired requirement on all your Bars objects it is recommend you start your OnBarUpdate() method with CurrentBars checks.

    4. A multi-series indicator will hold the same number of data points for plots as the primary series. Setting values to plots should be done in the primary series in OnBarUpdate(). If you are using calculations based off of a larger secondary series, it may plot like a step ladder because there are more data points available than there are actual meaningful data values.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you.

      Comment


        #4
        Bertrand,

        I have a multiseries question pertaining to the amount of data loaded.

        Lets say my primary series is a 1 minute chart, and internal to the indicator I also am computing a 5 period SMA on a Weekly dataseries. How many days worth of data do I need to load in the primary series, for the secondary weekly series to compute its 5 week SMA?
        mrlogik
        NinjaTrader Ecosystem Vendor - Purelogik Trading

        Comment


          #5
          You would still need 5 weeks of data for the SMA to be properly initialized on the second series - I would try around 30 days, then the values should match up closely between indicator value and weekly chart.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Hi Bertrand,

            So then if I use a 1 Month series, also with an SMA of 5, I will then need about 155 days or so loaded on my 1 minute chart.

            Correct?
            mrlogik
            NinjaTrader Ecosystem Vendor - Purelogik Trading

            Comment


              #7
              Hi again Bertrand,

              I loaded 200 days of 5 minute and do not get a 5 SMA on Monthly data. Can you explain how the loading logic is coded so we can define a procedure for multiseries indicators, and the associated data lookup?

              Thanks.
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                Which symbol, session and feed are you testing on? You would need 5 monthly bars then before the 5 SMA value would make any sense from the calcs.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hi Bertrand,

                  I am testing on ES ##-##, with a custom session template set to (I have made this the default for ES ##-##):



                  start sunday 9.30, end monday 9.30
                  start monday 9.30, end tuesday 9.30
                  start tuesday 9.30, end wednesday 9.30
                  start wednesday 9.30, end thursday 9.30
                  start thursday 9.30, end friday 9.30
                  start friday 9.30, end saturday 9.30
                  start saturday 9.30, end sunday 9.30


                  I have tested with both esignal and kinetick datafeeds, loading 200 days of 5 minute data.

                  Thoughts?
                  mrlogik
                  NinjaTrader Ecosystem Vendor - Purelogik Trading

                  Comment


                    #10
                    MrLogik, could you give this a try on the Default 24/7 data series to see if the session template is the issue here? If that doesn't work, try the Default 24/5, and if that doesn't work, I'll need to investigate further.
                    AustinNinjaTrader Customer Service

                    Comment


                      #11
                      Sure, I'll get back to you on that.
                      mrlogik
                      NinjaTrader Ecosystem Vendor - Purelogik Trading

                      Comment


                        #12
                        Hi Austin,

                        Unfortunately this occurs with the default templates as well.

                        Please advise. If I need to directly communicate with you with indicators / etc, I can do so.
                        mrlogik
                        NinjaTrader Ecosystem Vendor - Purelogik Trading

                        Comment


                          #13
                          mrlogik, thanks - if you could send us the indicator(s) and workspace you see this issue with that would help greatly. If you put Attn Austin in the subject he will take a look once he's in and get back to you.

                          Thanks,
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Encapsulation: Minute &amp; Daily data requirements

                            Hello:

                            I have reviewed this and other threads related to data requirements in multi timeframe indicators. This one appears to be related to my question, which is the following:

                            Is there any way to code the indicator to ensure that the secondary data series (BarsInProgress = 1) has enough data when the primary data series is requesting less than necessary?

                            For example:
                            Primary data series - 78 minute chart with 21 days of data
                            Secondary data series - Daily data requires 365 bars

                            I guess the main question is how to specify that the indicator LOAD the number of bars (e.g., 365 bars) required for the seconday data series irrespective of the data loaded on the primary data series.

                            Thanks.

                            Tony

                            Comment


                              #15
                              Hi Tony, that's unfortunately not possible currently, the primary series will determine how much data is loaded - we have this on our product enhancement list for future consideration though to provide an enhanced overload here.
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              16 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,785 views
                              0 likes
                              Last Post Leafcutter  
                              Started by poplagelu, Today, 05:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post poplagelu  
                              Started by fx.practic, 10-15-2013, 12:53 AM
                              5 responses
                              5,407 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Working...
                              X