/******************************************************************** Title: Generic 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 'butterfly-type' patterns. Specifically, the patterns that it can be used to find are Gartley, Crab, Bat Butterfly and Manual. In 'Manual' mode, you can specify the retracement ranges to be used for all of the retracements/projections that comprise this type of pattern. In addition, 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 patterns of the selected pattern-type 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. 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 2 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 2 to 40. Specify Pattern: Select the specific pattern that you want the script to search for. Options are Manual, Gartley, Crab, Bat and Butterfly. When 'Manual' is selected, you will need to specify the retracement/projection settings for each of the components that comprise the pattern. 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 "D" 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: Only valid when 'Manual' has been selected under the Specify Pattern parameter. 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: Only valid when 'Manual' has been selected under the Specify Pattern parameter. 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-AB Min: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the minimum percentage that the BC leg of the pattern should retrace/project the AB 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-AB Max: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the maximum percentage that the BC leg of the pattern should retrace/project the AB leg. Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) CD-BC Min: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the minimum percentage that the CD leg of the pattern should retrace/project the BC leg. Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) CD-BC Max: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the maximum percentage that the CD leg of the pattern should retrace/project the BC leg. Enter the percentage as a decimal value (e.g. 10% would be entered as 0.10, 127% would be entered as 1.27) AD-XA Min: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the minimum percentage that the AD 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) AD-XA Max: Only valid when 'Manual' has been selected under the Specify Pattern parameter. Enter the maximum percentage that the AD 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) 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 butterfly-type 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, C and D 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 WARNING.WAV. Button Vert Offset: Specify the vertical pixel offset for the menu button. A vertical offset of 0 would be the very bottom of the chart. Button Horz Offset: Specify the horizontal pixel offset for the menu button. A horizontal offset of 0 would be the very left of the chart. Pivot Strength Explanation The end-points of a butterfly-type pattern are based on swing-pivot points that occur in your price data. For a bearish Gartely 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 butterfly-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 butterfly-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. **********************************************************************/