/*********************************************************************************************** Title: Triangle Pattern Watchlist Indicator for eSignal By: Divergence Software, Inc. Web: http://www.sr-analyst.com ================================================================================================ Project Description: This is a companion indicator to the Triangle Pattern, Chart Version. Typically you would use this Watchlist version to monitor for pattern activity in a basket of securities and then use the chart version of this same indicator to view the actual patterns in a chart. This indicator will identify (and display in a Watchlist) triangle patterns (i.e., Ascending, Descending, and Common) based on swing settings and filters that you define via the menu interface, and it will generate alerts whenever these patterns are found. It will identify confirmed triangle patterns as well as pending triangle patterns (i.e., triangle formations that are not yet fully completed). The swing logic used is also very flexible. For purposes of defining swings, you can select from: Point Move - For a swing to be confirmed price must move at least X points in the opposite direction (we provide a menu option where you can define X). Percent Move - For a swing to be confirmed price must move at least Y percent in the opposite direction (we provide a menu option where you can define Y). ATR Multiple - For a swing to be confirmed price must move at least Z multiples of the current ATR value in the opposite direction (we provide a menu option where you can define Z). The default setting is ATR Multiple since it is the most adaptable to differing price scales, which is very handy if you frequently change symbols and/or bar intervals. In addition to the ability to toggle the three types of triangles (i.e., Ascending, Descending, and Common) on and off, filters are provided so that you can adjust the triangle identification logic to your specific needs. For ascending and descending triangles you can adjust the tolerance (a percentage value) that will be used to identify the triangle top (for an ascending triangle) and the triangle bottom (for a descending triangle). If this tolerance is 0 then the top (ascending) or bottom (descending) must be perfectly horizontal, which would be the classic definition of an ascending or descending triangle. However, if you set this tolerance to 1%, for example, then the top can be up to 1% (relative to the top-to- bottom range of the triangle) out of horizontal alignment and still qualify as an ascending triangle. Reverse would be true for a descending triangle. For common triangles you can adjust where the endpoint must be relative to the high-to-low range of the triangle base. So, using the default value of 60%, as long as the triangle endpoint is <= the triangle range midpoint plus 30% and >= the triangle range midpoint minus 30% then it will be considered a valid triangle. If you wish to only focus on very symmetrical triangles then reduce this value to a smaller percentage. The default settings for Ascending/Descending Price Tolerance and for Endpoint Location Tolerance are 2% and 60% respectively, and these settings will generate a fair number of triangles in most securities and intervals. If you only want to see triangles based on the classic definition then I would suggest that you set Ascending/Descending Price Tolerance to 1% or less and set Endpoint Location Tolerance to 15%. Triangles are typically continuation patterns (although they can at times be reversal patterns) and they identify periods of consolidation. Generally you will anticipate breakouts of the triangle in the direction of the prevailing trend but be prepared for a breakount in the opposite direction as well. A breakout that occurs early in the formation of the triangle (around the 1/2 way point or earlier) is often an indication that price will reverse soon so be cautious in this situation. Watchlist Operation: ===================================================================== When run in a Watchlist, this indicator will display a code if a pending or confirmed triangle is currently active. The order of precedence is it will look for pending triangles first, and if a pending triangle is not found then it will look for an active confirmed triangle. If multiple confirmed triangles are currently active (this is possible depending upon the swing settings you have selected) then it will display the code for the confirmed pattern that was most recently created. A triangle is considered active if the endpoint of the triangle has not yet been reached. It is possible that price may already be above or below the triangle, but as long as the endpoint of the triangle has not yet been passed then it will be considered an active triangle for purposes of the Watchlist display. The possible codes that this indicator will display in a Watchlist are: Asc (P) - a Pending Ascending Triangle is currently active. Dsc (P) - a Pending Descending Triangle is currently active. Cmn (P) - a Pending Common Triangle is currently active. Asc - a Confirmed Ascending Triangle is currently active. Dsc - a Confirmed Descending Triangle is currently active. Cmn - a Confirmed Common triangle is currently active. If no pattern is currently active for a particular security then the Watchlist cell will be empty. IMPORTANT! - when using this indicator it is critical that you apply a Time Template to your watchlist that pre-loads at least 400 bars. You can easily create a new Time Template item if you do not already have on in place in your Time Template dialog. If you do NOT do this then it is unlikely that the Watchlist will reflect the actual pattern activity as compared to the chart version. For more information on Time Templates and how to use them please visit the eSignal Knowledgebase and enter the search term "Time Template". You will find several tutorial articles on the subject. The URL for the eSignal Knowledgebase is: http://kb.esignalcentral.com/ Also, when using this Watchlist indicator with a large basket of securities please be sure to turn off the Hibernate feature under the Watchlist menu. Script Parameters: ===================================================================== Interval: Input the bar interval under which this indicator should run in the Watchlist. The default will always be D for Daily. Swing Construction Logic: Select from Point Move, Percent Move, or ATR Multiple. Please see discussion above regarding these 3 options. Point Move: Input the minimum number of points that price must move to confirm a swing. Only used if "Point Move" is selected as the Swing Construction Logic. Percent Move: Input the minimum percentage that price must move to confirm a swing. Only used if "Percent Move" is selected as the Swing Construction Logic. ATR Multiple: Input the multiples of ATR that should be used to confirm price swings. Only used if "ATR Multiple" is selected as the Swing Construction Logic. ATR Period: Input the period/length to be used for the ATR calculation. Only used if "ATR Multiple" is selected as the Swing Construction Logic. Show Ascending Triangles: Select true or false. If true then all ascending triangles will be identified and displayed in the Watchlist if found. Show Descending Triangles: Select true or false. If true then all descending triangles will be identified and and displayed in the Watchlist if found. Show Common Triangles: Select true or false. If true then all common triangles will be identified and displayed in the Watchlist if found. A "common" triangle is any triangle formation that meets the Endpoint Location Tolerance test (see below). Display Pending Triangles: Select true or false. If true then the indicator will search for and display any pending triangles that are found. Minimum Bars Remaining: Input the minimum number of bars that must remain between the current price bar and the point in the future where the triangle lines intersect. This is simply a filter that will prevent very short triangles from plotting. Default is 6 bars. Endpoint Location Tolerance: Input the percentage to be used to filter "common" triangles. The value input here determines how "symmetrical" the triangle formation must be. So, a value of 0 would require that the triangle end-point be exactly at the midpoint of the triangle high-to-low range. A value of 30 (30%) would allow the endpoint to be anywhere between the triangle midpoint plus 15% and the triangle midpoint minus 15%. The default value is 60%. Ascending/Descending Price Tolerance: Input the percentage that will be used in identifying Ascending and Descending triangles. Typically an Ascending triangle would be based on two swing highs that share exactly the same price value. And the reverse would be true of a Descending triangle. This input allows you to apply some tolerance so that the two swing highs (or swing lows) do not have to be identical in order to be defined as Ascending or Descending triangles. Default value is 2% and this is measured against the high-to-low range of the triangle. Maintain Watchlist Striping?: Select true or false. If true then the natural background cell striping of the watchlist will be preserved when setting the cell colors. Ascending Triangle FG Color: The foreground color to use when dislaying the Ascending Triangle code in the Watchlist (i.e., Asc or Asc (P)). BG Color: The background color to use when dislaying the Ascending Triangle code in the Watchlist (i.e., Asc or Asc (P)). BG color will only be used if Maintain Watchlist Striping is set to false. Descending Triangle FG Color: The foreground color to use when dislaying the Descending Triangle code in the Watchlist (i.e., Dsc or Dsc (P)). BG Color: The background color to use when dislaying the Descending Triangle code in the Watchlist (i.e., Dsc or Dsc (P)). BG color will only be used if Maintain Watchlist Striping is set to false. Common Triangle FG Color: The foreground color to use when dislaying the Common Triangle code in the Watchlist (i.e., Cmn or Cmn (P)). BG Color: The background color to use when dislaying the Common Triangle code in the Watchlist (i.e., Cmn or Cmn (P)). BG color will only be used if Maintain Watchlist Striping is set to false. Default FG Color: The default cell foreground color. BG Color: The default cell background color. Use Sound Alerts?: Select true or false. Set this option to true to generate a sound alert whenever a pending or confirmed triangle pattern is found. Use Popup Alerts?: Select true or false. Set this option to true to generate a popup alert whenever a pending or confirmed triangle pattern is found. Pending Triangle Alert WAV File: Use this option to set the WAV file that will play when a Sound Alert is triggered for a pending triangle pattern signal. Any sound file that exists in your eSignal Sound Files Root directory can be entered here. Remember to use the ".WAV" extension. Confirmed Triangle Alert WAV File: Use this option to set the WAV file that will play when a Sound Alert is triggered for a confirmed triangle pattern signal. Any sound file that exists in your eSignal Sound Files Root directory can be entered here. Remember to use the ".WAV" extension. Disclaimer: For educational purposes only! Obviously, no guarantees whatsoever and use at your own risk. **********************************************************************/