NinjaTrader Support Forum How to spot double tops when they occur at a given Level
 User Name Remember Me? Password
 NinjaTrader Register FAQ Members List

 Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

 Thread Tools Display Modes
03-13-2018, 05:16 AM   #1
guidoisot
Member

Join Date: May 2011
Posts: 77
Thanks: 55
Thanked 9 times in 7 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 Images
 ES 06-18 (10 Minute) 2018_02_16.png (94.8 KB, 12 views) Strategy Builder looking for Double Top patterns.JPG (64.2 KB, 12 views)
Last edited by guidoisot; 03-13-2018 at 07:32 AM.

 The following user says thank you to NinjaTrader_Jim for this post:
03-16-2018, 10:51 AM   #4

Join Date: Nov 2016
Location: Denver, CO
Posts: 1,828
Thanks: 98
Thanked 493 times in 468 posts

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.

Quote:
 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.

 The following user says thank you to NinjaTrader_Jim for this post:
 03-16-2018, 01:05 PM #5 guidoisot Member   Join Date: May 2011 Posts: 77 Thanks: 55 Thanked 9 times in 7 posts 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.
 03-19-2018, 12:36 PM #6 gubbar924 Senior Member   Join Date: Aug 2011 Posts: 148 Thanks: 27 Thanked 52 times in 41 posts 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
 The following user says thank you to gubbar924 for this post:
 03-20-2018, 04:28 AM #7 guidoisot Member   Join Date: May 2011 Posts: 77 Thanks: 55 Thanked 9 times in 7 posts 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 at 04:38 AM.
03-28-2018, 06:17 AM   #9
guidoisot
Member

Join Date: May 2011
Posts: 77
Thanks: 55
Thanked 9 times in 7 posts

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 Images
 NQ 06-18 (750 Volume) 2018_03_28.png (199.2 KB, 12 views)
Last edited by guidoisot; 03-28-2018 at 06:32 AM.

03-28-2018, 06:23 AM   #10
guidoisot
Member

Join Date: May 2011
Posts: 77
Thanks: 55
Thanked 9 times in 7 posts

few minutes later it did actually go down to visit POC.
Looks good.
Attached Images
 NQ 06-18 (750 Volume) 2018_03_28.png (207.2 KB, 22 views)

07-04-2018, 04:09 AM   #12
guidoisot
Member

Join Date: May 2011
Posts: 77
Thanks: 55
Thanked 9 times in 7 posts

Quote:
 Originally Posted by guidoisot 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.

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 at 04:14 AM.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News and Announcements     News and Announcements NinjaTrader 8     Platform Technical Support     Add-On Development     Indicator Development     Strategy Development NinjaTrader 7     Platform Technical Support     General Development     Indicator Development     Strategy Development NinjaScript File Sharing     NinjaScript File Sharing Discussion     Version 8 Add-Ons     Version 8 Indicators     Version 8 Strategies     Version 7 Indicators     Version 7 Strategies     Version 7 Miscellaneous NinjaScript Educational Resources     Reference Samples     Tips Suggestions and Feedback     Suggestions And Feedback Historical Beta Archive     Version 8 Beta

 Similar Threads Thread Thread Starter Forum Replies Last Post GainForex Strategy Development 5 08-19-2015 01:28 PM rana.irfan Strategy Development 3 07-03-2013 06:31 AM bbucha_stk Platform Technical Support 1 01-18-2012 04:28 PM td_910 Indicator Development 2 12-17-2011 12:39 PM zq655 Platform Technical Support 2 04-20-2008 02:42 PM

All times are GMT -6. The time now is 01:31 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.