• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to spot double tops when they occur at a given Level

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

    How to spot double tops when they occur at a given Level

    I am trying to build a logic with the Strategy Builder for identifying double top patterns when they occur at a given meaningful level.
    In the example shown on the attachment I am considering as a Level the price corresponding to MAX(144) and a distance of 50 bars between the two tops.
    What I have written in the S. Builder does not give any signal, whereas by looking at the chart there should be some signals (chart example on the other attachment).
    Can anyone explain where is the mistake in the SBuilder script?
    Any suggestion on how to spot a double top patterns at a given level (for ex. POC, VAH, VAL, prior day high and low, VWAP, SMA, ..... ) would be most welcome.
    Thanks.
    Attached Files
    Last edited by guidoisot; 03-13-2018, 07:32 AM.

    #2
    Hello guidoisot,

    Thanks for opening the thread.

    There are a couple lines that stick out, but ultimately, the code will need to be tested with prints so you can better visualize what is occurring with the logic so you can tweak it as necessary. I'll include a video demonstration for setting up debug prints in the Strategy Builder.

    Debugging in the Strategy Builder - https://www.screencast.com/t/8uvjfM8h

    In your conditions, you are checking if the MAX of the last 50 bars is equal to the MAX of the last 144 bars + 2 ticks. This is not likely to become true as the MAX of the last 50 bars could be high for the MAX of the last 144 bars. This value then cannot equal itself + 2 ticks. When comparing offsets to see if you are in range, I would recommend to use greater and less than conditions to see if the either end is within the 2 tick offset of the other side.

    I may also suggest to save the barsAgo value returned from HighestBar() and use it in your MAX() indicator so you can look back to the MAX value from before your first found HighestBar(). For example: MAX(144)[barsAgo] will return the highest value looking back 144 bars from your first high point. If this MAX value is within range of your first high, then you have discovered a double top. Additional filtering logic may be required if this MAX value is on a downward slope. Drawing from each of these points would not be possible taking this approach, since HighestBar() cannot be given a barsAgo value to start looking back from. You could draw a line 144 bars back from the HighestBar()'s barsAgo value, however.

    When designing the logic, I recommend creating conditions in small parts and using prints as described in the video above to determine if the condition is written correctly. This way, you can check your work and continue creating additional logic.

    Please keep in mind, the Strategy Builder is only designed for very simple strategies. What you are trying to accomplish may be possible in the Strategy Builder to some degree, but this kind of analysis would typically be done with loops in the NinjaScript Editor.

    We cannot offer services to write Strategy Builder logic or to create, modify, or debug client code. This is because we are a small team and cannot take on these sorts of tasks for all of our clients. If you are interested in those services, I can have a member of our Sales Support team provide more information on NinjaScript Consultants.

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,
      Thank you for your reply. Let me start saying that I appreciated very much you explanation that you guys at support have limited resources vs the huge number of requests you receive every day. I have to admit, I did not consider this aspect.
      Regarding the offset I did ask my self, while drafting the strategy, whether or not it (also) had an algebraic sign, but I thought signs applied only to the arithmetic offset (which I am not sure what it actually represents) not to percentage offset, therefore I assumed that percentage offset was an absolute offset on both sides. … I learned a new detail about the platform. Thanks.
      Regarding the next paragraph I do not really understand the message. I shall have to think a bit more about it, however if you have some spare time please let me have some additional guidance on how one could save the highest bar value (maybe setting a double on the sub-panel “Variables” of the tab “input and Variables”?) and how to use it. Then also this sentence is not so easy to understand for me “For example: MAX(144)[barsAgo] will return the highest value looking back 144 bars from your first high point. If this MAX value is within range of your first high, then you have discovered a double top”.


      Hi @Arkadiy_B thank you again for kindly posting at https://ninjatrader.com/support/foru...14&postcount=9 the zip of the modified indicator Volume profile.


      I hope you don’t mind if I copy to you this post regarding the strategy I was going to develop. It is because such strategy could be conveniently related to your dPOC indicator about which I found out just these days. Actually, I suppose that POC would be a much more interesting level, rather than MAX(144), for double checking its confluence with a divergence. It appears to me that you you are very familiar with NT scripting, would you perhaps like joining this thread and offer some help in building its sample strategy? I suppose you might include your indicator dPOC in it and/or also refer the whole strategy to POC.
      Thank you.
      Last edited by guidoisot; 03-15-2018, 10:56 AM.

      Comment


        #4
        Hello guidoisot,

        Yes, you would use a variable created in the Inputs and Variables tab of the Strategy Builder and then you would set that variable to the output from HighestBar() in an action under the Condition and Actions tab. In an Action, you can set a variable value under Misc > Set MyVariable.

        Then also this sentence is not so easy to understand for me “For example: MAX(144)[barsAgo] will return the highest value looking back 144 bars from your first high point. If this MAX value is within range of your first high, then you have discovered a double top”.
        We can consider the following for a barsAgo reference:
        • MAX(144)[0] will look at the MAX value going 144 bars back from the current bar.
        • MAX(144)[3] will look at the MAX value going 144 bars back from 3 bars ago.
        • MAX(144)[barsAgo] will look at the MAX value going 144 bars back starting from the current bar minus the value of barsAgo. If barsAgo is 5, then we would look at the MAX value going 144 bars back from 5 bars ago.


        I also should have been clearer in my response. It is not possible to set a barsAgo reference as a variable in the Strategy Builder. Considering this, I do not think this can be accomplished with the Strategy Builder and custom programming will be necessary.

        If there is anything else we can do to help out, please let us know.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thank you Jim.
          I will try over the weekend to see whether I will be able to get, at least partially, the signals I started this thread for.
          I have been also looking at whether one could exploit the free Price Action Swing (PAS) indicator for this, but it appears that PAS cannot be used, neither for getting market analyzer signals, nor for automated strategies.
          The same seems to apply to the other free divergence indicators I know of, such as:
          D3SpotterV3B2 Updated by @GeorgeW or
          Divergence Input Series for NT8 by @aligator , ( …. however this last one, with its gradient colored bars, seems to be a good option for manual executions, because I understand it can give early messages that a divergence is almost fully developed).
          The same applies also to the divergence indicator for sale by Moore Tech, LLC @toptrader.

          I have mentioned some forum members who worked on divergence indicators, because they may wish either to contribute here, or they may prefer to offer their help as programming services, in such case please either pm me or post a quote here (…. maybe other forum members would like to share the cost) for creating an indicator and a market analyzer that can spot double tops/bottoms "when they occur at a given meaningful Level".

          Thanks.

          Comment


            #6
            this indicator seems to already have done a lot of the leg work, perhaps you can just modify as needed

            https://ninjatrader.com/support/foru...atid=7&lpage=3

            Comment


              #7
              Thank you indeed for the interesting suggestion.
              I am now looking at the indicator script on the editor, but I realize that it is written with a language I do not really understand enough.
              If I remember correctly from my times when I had been studying some basic programming (Fortran, for about a quarter, few decades ago ...) the logic of the code of a program can be sketched using a corresponding block chart called "flow chart". Maybe having this indicator flow chart in front of me would let me understand better what this script is doing and how I could possibly modify it in order to apply it also to other patterns (double tops or bottoms).

              @NinjaTrader_PatrickH
              - do you have and could you perhaps post the flow chart of this script that you have created?
              - Alternatively, as regards license issues, is it possible for Ninjatrader users to copy and paste the code of the indicators posted here on the forum on a web tool like this one: https://code2flow.com/#pricing , just in order to get for our own personal use the corresponding flow charts?
              - for the future do you think it would be helpful for Ninjatrader users not so proficient in C# to be able to access also the flow charts of the Ninjatrader scripts posted here on the forum, for ex. a starting point could be those scripts derived from Stocks and Commodities Magazine publications.
              Thank you.
              Last edited by guidoisot; 03-20-2018, 04:38 AM.

              Comment


                #8
                Hello guidoisot,

                There can be a lot that goes into modifying an indicator so it can do exactly what you would like it to. We can provide some introductory materials for NinjaScripts, but we could not offer direction for specific modifications to customize a script. (We do not have the bandwidth to direct clients to make their own modifications. NinjaScripts will require some programming background, as well as time for trial-and-error testing and debugging. Additionally, we cannot offer C# programming education in the Support Department.)

                I'll include some indicator tutorials as well as some basic programming concepts if you would like to learn C# and make the modifications on your own. This information is publicly available. If you would like to go more indepth, I would recommend viewing external C# resources to build your programming background.

                Indicator tutorials NT7 - https://ninjatrader.com/support/help...indicators.htm

                Basic Programming Concepts NT7 - https://ninjatrader.com/support/help...g_concepts.htm

                Code Breaking Changes NT8 - https://ninjatrader.com/support/help...ng_changes.htm

                The source code for the indicator is openly available. If you would like to paste the source code in a tool that creates a flow chart, you may do so. Since NinjaScripts are based on C#, there is a certain expectation that if someone wants to modify the script, they can read and understand the code enough to make the necessary modifications. 3rd party flow chart tools are openly available on the internet and you may use any of those available if they can assist with your understanding of the script.

                If you would like, we can also have a representative for our EcoSystem reach out with additional information on NinjaScript Consultants who would be happy to make any modifications at your request. Please let me know if this interests you.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Attached is nice double top at VAH with divergence occurring right now

                  I am looking for an indicator telling me this both with an alert and on on the market analyzer..
                  Can any programmer develop a custom script that can do this?
                  Ready to pay a mutually agreed price for this "indicator with market analyzer"
                  Anyone willing to do that, please post here on this thread your quote and terms.
                  Only prerequisite condition on my side is that I would like to attend via remote session while the script is being developed.
                  If other forum members would like to join and share the cost, the remote sessions, and the script, just join the thread and ask to do so.
                  Attached Files
                  Last edited by guidoisot; 03-28-2018, 06:32 AM.

                  Comment


                    #10
                    few minutes later it did actually go down to visit POC.
                    Looks good.
                    Attached Files

                    Comment


                      #11
                      Hello guidoisot

                      You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
                      You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

                      This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

                      Let me know if I may be of further assistance.
                      Christopher D.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by guidoisot View Post
                        I am trying to build a logic with the Strategy Builder for identifying double top patterns when they occur at a given meaningful level.

                        ...

                        Any suggestion on how to spot a double top patterns at a given level (for ex. POC, VAH, VAL, prior day high and low, VWAP, SMA, ..... ) ?
                        Thanks.

                        I noticed it already exists a similar indicator for another platform https://www.forexfactory.com/showthread.php?t=713972

                        Can anyone try to develop something similar for NT8?


                        @gubbar924
                        thanks for referencing in your post the HS indicator, but unfortunately I do not have programming skills allowing me to follow up starting from it.

                        @algotrading
                        maybe you would like to add such an indicator to the list of free indicators on your website?
                        Last edited by guidoisot; 07-04-2018, 04:14 AM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by supermht, Today, 07:59 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post supermht  
                        Started by mohdhm, Today, 05:13 PM
                        1 response
                        12 views
                        0 likes
                        Last Post nkhoi
                        by nkhoi
                         
                        Started by 3lliot, Today, 05:55 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post 3lliot
                        by 3lliot
                         
                        Started by Fargo, Today, 04:57 PM
                        0 responses
                        11 views
                        0 likes
                        Last Post Fargo
                        by Fargo
                         
                        Started by Johnny Santiago, Today, 03:57 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post Johnny Santiago  
                        Working...
                        X