/******************************************************************** Title: Three Leg Pattern Script for eSignal 10.x By: Chris D. Kryza (Divergence Software, Inc.) Email: ckryza@verizon.net; ckryza@sr-analyst.com Version: 1.3.0 ===================================================================== Project Description: This script will identify and label bearish and bullish 3-leg patterns. The script can be configured to search for these patterns over a range of pivot-strength settings which makes it very flexible. (See the Pivot Strength Explanation section at the end of this document). When loaded, the script will highlight all 3-leg patterns that have occured in the historical data. As new bars come in, the script will identify new patterns as they form. Additionally, sound and pop-up alerts can be activated so that you will be alerted immediately as new patterns are found. Drawing The script will draw the actual 3-leg pattern as a bold black line. A magenta line will be drawn from point X to point B and the AB/XA retracement will be displayed on this line. A second magenta line will be drawn from point A to point C and the BC/XA ratio will be displayed on this line (e.g. the size relationship between the BC leg and the XA leg. Parameters: Pivot Strength Start: This is the 'starting' pivot strength setting that you want the script to use when searching for patterns. Valid range is from 1 to 40. Pivot Strength End: This is the 'ending' pivot strength setting that you want the script to use when searching for patterns. Valid range is from 1 to 40. Auto-Extend: This parameter controls how a pattern will be displayed on the chart. If Auto-Extend is set to (True), which is the default, the "C" leg of a pattern will be extended as each new bar completes as long as the pattern is still valid. When Auto-Extend is set to (False), the pattern will be considered complete on the first bar that all pattern criteria have been met. Show Bullish: This parameter allows you to filter the display of patterns. When set to (True), all bullish patterns will be displayed. When set to (False), all bullish patterns will be ignored. Show Bearish: This parameter allows you to filter the display of patterns. When set to (True), all bearish patterns will be displayed. When set to (False), all bearish patterns will be ignored. AB-XA Min: Enter the minimum percentage that the AB leg of the pattern should retrace/project the XA leg. Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) AB-XA Max: Enter the maximum percentage that the AB leg of the pattern should retrace/project the XA leg. Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) BC-XA Size Min: Enter the minimum ratio of the BC leg length to the XA leg length. The default is 1.0 which means that the BC leg must equal the XA leg. Enter the ratio as a decimal value (e.g., 1.0 or 0.75, etc.) BC-XA Size Max: Enter the maximum ratio of the BC leg length to the XA leg length. The default is 1.0 which means that the BC leg must equal the XA leg. Enter the ratio as a decimal value (e.g., 1.0 or 0.75, etc.) Fudge Factor: This parameter is used to specify the amount of leeway, in the form of a percentage, that you wish to apply to all of the retracement values. The default is 0.10 (10%). Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) Pattern Color: This is the color that will be used to draw the primary pattern (e.g., the 3-leg shape). Default is Navy. Outline Color: This is the color that will be used to draw the retracement connector lines. The default is Magenta. Label Color: This is the color that will be used to draw the leg labels (e.g., the X, A, B and C identifiers). Default is Blue. Legend Color: This is the color that will be used to draw the retracement values over the outline lines. The default is Black. Pattern Thickness: This is the default thickness to use when drawing the primary pattern. The default value is 2. Outline Thickness: This is the default thickness to use when drawing the retracement connector lines. The default value is 1. Use Sound Alerts: Set to (True) if you want a sound alert to be triggered when a new pattern is found in realtime. Otherwise, set to (False). Default value is (False). Use Popup Alerts: Set to (True) if you want a popup alert to be triggered when a new pattern is found in realtime. Otherwise, set to (False). Default value is (False). Use Email Alerts: Set to (True) if you want an email alert to be triggered when a new pattern is found in realtime. Otherwise, set to (False). Default value is (False). Alert WAV File: Type in the name of the sound file (WAV File) that should be used for sound alerts. The default is BULLET.WAV. Pivot Strength Explanation The end-points of a 3-Leg-type pattern are based on swing-pivot points that occur in your price data. For a bullish 3-leg pattern, the "X" point will be a swing-pivot high, the "A" point will be a swing-pivot low and so on. The real issue when trying to find 3-leg-type patterns is deciding upon the criteria to use to define a swing-pivot high and a swing-pivot low. This script uses the concept of "Pivot Strength" to define swing-pivot highs and lows. For example, if a Pivot-Strength of 2 is selected then a swing-pivot high would be any high that has 2 lower highs on either side of it. The reverse would be true for a swing-pivot low. To extend the logic further, a Pivot-Strength of 3 would require that a high has 3 lower highs on either side of it and, again, the reverse would hold true for swing-pivot lows. Generally, the smaller the Pivot-Strength setting, the more swing-pivots you will find in your data, but they will tend to be small swings. A large Pivot-Strength setting (e.g., a requirement of 8 or 9 bars on either side of a high or low) will result in fewer swing-pivots but these price swings will tend to be much larger. This script allows you to specify a range of Pivot-Strength settings and, when activated, the script will monitor the formation of patterns for all of the Pivot-Strength values in that range. So, for example, if you set the Pivot Strength Start parameter to 3 and the Pivot Strength End parameter to 10, the script will, internally, create and store all swing-pivots found with a Pivot Strength setting of 3, all swing-pivots found with a Pivot-Strength setting of 4, and so on all the way up to a Pivot-Strength setting of 10. As each new bar comes it, it will scan for valid 3-leg-type patterns at each one of these Pivot-Strength levels and will draw them on the screen if found. Please note that the larger the range you specify, the longer it will take for the script to load and the longer it will take for the script to advance as each new bar comes in. It is probably a good idea to restrict your range to 10 elements or less (e.g., a range of 3 to 13 should be just fine but a range of 3 to 30 is pushing it.) Dislaimer: For educational purposes only! Obviously, no guarantees whatsoever and use at your own risk. **********************************************************************/