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 time frame strategy

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

    Multi time frame strategy

    Hello

    I am trying to create a new Multi time frame strategy with Strategy Builder in NT8 (I am a complete coding idiot ). The strategy would use Weekly and Daily TF and it would use 3 indicators on both TF's (2 EMA's, ADX and Rsqueeze attached below). I have two questions on how to start it.

    1. Which TF ought to be the main one, weekly or daily? My guess is daily, but I am not sure. Any shared experiences are appreciated

    2. How to tell the Strategy Builder on which bar it should start counting? If you check the attached picture, the Strategy should start counting if the horizontal dots turn from red to green up to max 8 bars (default setting to 8, but it can be changed).

    Thanks

    Attached Files

    #2
    Hello pirnat,

    Thanks for your post.

    The main bars are what the chart is set to. If you use daily bars on the chart then that is the data series the strategy would send orders based on.

    The indicator you attached is for NT7, are you really wanting this post to be in the NT7 strategy forum?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks

      Is it possie to run the Strategy simoultaneously on multiple markets e.g. on Market Analyzer?

      How do I start counting the weekly pulse bars?

      Comment


        #4
        Hello pirnat,

        Thanks for your reply.

        The strategy analyzer and market analyzer are two different uses. The strategy analyzer can be used to perform historical analysis of strategy performance and yes it can be applied to multiple instruments at one time.

        The market analyzer is a real-time display that offers multiple columns to display various real-time information. The market analyzer would not relate to a strategy. You can add indicators to a market analyzer indicator column to see for example the value of the 50 period EMA on multiple instruments at the same time.

        Regarding "How do I start counting the weekly pulse bars?", I do not know what these are and could not advise. Can you provide further information on what the source would be for a pulse bar or how it is determined?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks for your answer Paul

          The Weekly pulse bars I am referring to the picture that I attached to my initial post. There I have marked with the arrow the point where some sort of a bar counter should start. I do not now on how to extract this data from the RSqueeze indicator (also attached to my initial post ). Any ideas on how to do this with Strategy Builder are appreciated.

          Comment


            #6
            Hello pirnat,

            Thanks for your reply and clarification.

            The indicator you posted will only work in NinjaTrader7, it is not compatible with NinjaTrader8 and would not work with the NT8 strategy builder.

            You will either need to convert the indicator to NinjaTrader8 or have it converted or locate an already converted indicator.


            There are a few key items to look for when converting your scripts from NinjaTrader 7 format to NinjaTrader 8, and we keep a Code Breaking Changes table updated in the NinjaTrader 8 Help Guide to assist in identifying changes or new implementations of familiar methods and properties from NinjaTrader 7: http://ninjatrader.com/support/helpG...ng_changes.htm

            Some notable items to consider when converting your code will be the following:
            • Initialization has changed significantly. Initialize() has been replaced with OnStateChange(), which can be used to filter out different stages of the entire life cycle of a script (SetDefaults, Configure, Historical, Realtime, Terminated, etc.) OnStateChange() is fully covered in the Help Guide.
            • The names of many methods and properties have changed slightly, so you will need to refactor these in your code. The Code Breaking Changes table can make this task much easier, and there is also an alphabetical reference in the Help Guide that can help to find new method/property names: http://ninjatrader.com/support/helpG..._reference.htm
            • In numerous instances, you now have direct access to objects, where in NinjaTrader 7 you had to work with interfaces. For example, rather than the IOrder interface, you now have direct access to an Order object and its related fields. This will require a change in the way items like this are handled in your code.

            As always, we are more than happy to help out with tips and advice in this area, although we do not offer full script conversion services.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Well the picture attached was done with NT8 and the indicator was given to me by one of your colleagues a day ago. It works in NT8, at least on the chart and in data window.

              I find Strategy builder aweseome, but I need to get more versed on how to extract particular indicators data out.

              Comment


                #8
                Hello pirnat,

                Thanks for your reply.

                The indicator you posted is for NT7 and will not work in NT8, there is no question on this. Is it possible that you have both NT7 and NT8 and have posted the NT7 version in error?

                The indicator appears to have a number of different plots. Plots are what you will need to use in the strategy builder to build your conditions with. You can use the indicator to determine which plot it is that you need to work with and what that condition is, for example, are you looking for that particular plot to cross above the zero line? In the strategy builder you would then select the indicator to select the specific plot to use in the "value plot" selector and build your conditions from there.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  You are right, this is the right one...My mistake.

                  So, if I understand correctly, I need to use this plots in order to decompose indicators inside values and then tell the strategy Builder what to do with it.

                  Will try. Thanks...
                  Attached Files

                  Comment


                    #10
                    Hello pirnat,

                    Thanks for your reply and posting the NT8 version.

                    In the NT8 version I think you would need to use the "MomentumHistogram" plot as the "value plot" to use in the strategy builder.

                    In the screenshots below, I show the strategy builder with the selections made and then a screenshot where the strategy builder colors the background when the momentum crosses above zero.

                    Click image for larger version

Name:	pirnat-1.PNG
Views:	952
Size:	153.1 KB
ID:	1039254

                    Click image for larger version

Name:	pirnat-2.PNG
Views:	965
Size:	35.2 KB
ID:	1039255
                    Attached Files
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      This is great. I will try it and let you know. Thanks

                      Comment


                        #12
                        Hello Guys. It works fine, but I have encountered another problem. Is there a way that I would tell the strategy that it should start a special timer (duration e.g, 7 weekly bars or according to setting of the input) after the crossover. I was thinking of defining an input variable e.g. T1 (preset to 7). Any ideas?

                        Comment


                          #13
                          Hello pirnat,

                          Thanks for your reply.

                          There would not be a way to accomplish your goal using the strategy builder. You would need to unlock the code and work directly in Ninjascript to create an int variable to save the value of CurrentBars[]. CurrentBars[] contains the count of the current bar being processed. So when the condition is true you would save the current bar number into the variable. When your other condition becomes true, you can then test to see if the difference between the CurrentBar[] and the saved bar is 7 or less.

                          Reference: https://ninjatrader.com/support/help...urrentbars.htm

                          Last edited by NinjaTrader_PaulH; 11-12-2018, 10:40 AM. Reason: Change the CurrentBar reference to CurrentBars[] as thread relates to Multi time frame.
                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            ok, thanks. I will stick to the Builder for now, but you can improve it some later edition with this feature.

                            Comment


                              #15
                              Hello pirnat,

                              Thanks for your reply.

                              We have added your vote to the existing feature request identified as, SFT-2059, "Expand mathematical offsets to all properties/methods in the Strategy Builder" which would allow what I described in post #13. A feature request does not mean it will or will not be implemented and if implemented you would be able to observe this in the release notes of the version it was released in. All version release notes can be found here: https://ninjatrader.com/support/help...ease_notes.htm

                              Thanks for your interest in improving NinjaTrader8 strategy builder.
                              Last edited by NinjaTrader_PaulH; 11-14-2018, 08:47 AM. Reason: Corrected SFT number.
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ZenCortexCLICK, Today, 04:58 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post ZenCortexCLICK  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              172 responses
                              2,281 views
                              0 likes
                              Last Post sidlercom80  
                              Started by Irukandji, Yesterday, 02:53 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post Irukandji  
                              Started by adeelshahzad, Today, 03:54 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post adeelshahzad  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              3 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X