ZUP - Universal ZigZag with Pesavento patterns. Search for patterns

Eugeni Neumoin | 7 June, 2018

Introduction

Many traders are interested in searching for patterns on price charts. This search can be performed using the ZUP indicator platform. There are several options for working with the platform. First, you can search for known patterns with strictly set parameters. Second, you can adjust the parameters to your requirements. Third, you can create your own patterns using the ZUP graphical interface and save their parameters to a file. This capability allows you to quickly check, whether these new patterns can be found on charts.

Patterns were described by many authors. One of them was Harold Gartley. Gartley published his book "Profits in the Stock Markets" back in 1935. One of the book pages contained an image of a pattern and a brief description of how it can be used for trading. Active development of this idea started only after several decades. Many new patterns were described at that time. One of the most famous authors of those patterns is Scott Carney. Carney developed a plethora of patterns, including the Gartley, the Bat, the Butterfly, the Crab and others. Scott Carney registered the copyright on all these patterns in 2016.

There are many algorithms for finding patterns. For example, you can select extremums on the chart, "stretch" the Fibonacci grid between them and determine the emergence of a pattern when the market reaches specific levels. This algorithm is used both for manual searching, and in some programs. Another option is a purely software solution. A program algorithm finds extreme points, checks their mutual arrangement, and if it corresponds to a pattern, the program shows an appropriate message.

Multiple possibilities for finding patterns are implemented in the ZUP indicator platform. They can be built manually. But the main algorithm is the automated search for patterns on market extremums, which are determined through various ZigZags. In ZUP versions up to 151, pattern search modes were set through parameters. But there are more than 100 parameters which can influence the search for patterns. Such an abundance of parameters complicates the task. A new option was introduced in version 152: the possibility to use the graphical interface. Basic settings are set through parameters, while fast connection of patterns to search is performed using the graphical interface.

For convenience, all parameters are divided into groups. Below are the groups of parameters, which affect search for patterns.

  1. ZigZag settings.
  2. 1 - Parameters for fibo Levels.
  3. 2 - Parameters for Pesavento Patterns.
  4. 3 - Parameters for Gartley Patterns.
  5. 15 - Common Parameters.

A large number of built-in graphical instruments can also help to find patterns.

In the first part of the article, I provide a description of how patterns can be connected to search through the graphical interface in ZUP version 152. Then I explain parameters for finding Gartley patterns. Other patterns are briefly considered in the end of the article.

Part One. Graphical interface for working with patterns

Graphical interface elements for working with patterns were added in version 152. The graphical interface enables the following:

  1. Connecting and disconnecting patterns from search;
  2. Viewing images with the templates of five-dot patterns;
  3. Creating new five-dot patterns;
  4. Editing parameters of five-dot patterns;
  5. Saving the edited patterns instead of the old one or in a separate *.CSV file;
  6. Saving a newly created pattern to a new or selected *.CSV file;
  7. Connecting patterns from the selected file to search;
  8. Creating lists of patterns to search for.

The ExtPanel parameter at the end of parameters list of the indicator platform is provided for working with the ZUP graphical interface. ExtPanel=true allows working with the graphical interface.

If you set ExtPanel=true, but the graphical interface does not show up or it has been deleted by pressing ESC, the combination of SHIFT-Z will display it.

Then press Insert. In the next menu, click on the "butterfly icon" —  butterfly.  This opens a menu for working with patterns:

menu

Compared to version 151, this one contains the Select button. A click on the button opens the following menu with a list:

menu viewing

The menu allows connecting patterns from the list to search or disconnecting them without using the indicator's parameters panel. This can be done by simply clicking on the appropriate button. The values of parameters of patterns to connect will be set in the list of ZUP parameters.

Button Viewing of 5 dot patterns opens the panel for working with five-dot patterns. A click on it opens the following screen with a chart:

chart

Note that the image with the pattern template is displayed using the MQL4 language. The coordinates of pattern points XABCD use the time of conditional bars on the chart. The time that can be set is limited to around 2033. Therefore, it is not recommended to maximally compress the chart on the MN timeframe when working with this UI element. The time of conditional bars, to which the patterns are "tied", may become more than 2033 when you compress the chart. This causes an error. When the chart is compressed to the maximum, the pattern template will either be distorted or will not be displayed at all.

What can be done with the resulting window?

Line     duplicates/replaces the value of the SelectPattern parameter, which sets groups of 5-dot patterns for search.


When you work with the graphical interface, the values of parameters set through this interface are used. If the graphical interface is disabled ExtPanel=false, values set on the indicator parameters editing tab are used. Individual parameters are available on each chart in this case.

The Bullish button in line Bullish/Bearish sets the display of an image with the bullish or bearish interpretation of the pattern template (by default, the bullish interpretation is shown first) and the name of the displayed pattern.

Line visible pattern corresponds to the visiblePattern parameter, which sets the list of patterns connected to the search.

Each position in this line corresponds to one of 33 built-in ZUP patterns. If 1 is set in the position of a selected pattern, it means the pattern is added to search. 0 means the pattern is not used.

You can change the list of patterns added to the search in several ways.

  1. Move the cursor to the selected position and click the left mouse button. The first click shows a picture with a pattern template. The second click changes 1 to 0 or 0 to 1.
  2. Using line select . Numbers 1 of 33 show the position, where the pink cursor is set. The cursor also shows which pattern is selected for manipulation. Use arrows to set the new position of the cursor. Yes/No changes 1 to 0 or 0 to 1.

    The Hide button sets all positions to 0, i.e. all patterns are removed from the search. The following should be noted here. You can add more than 33 patterns to the search. But the line of ones and zeros has only 33 positions. When the pink cursor is moved to the leftmost position and << is clicked, the previous 33 patterns are shown. When you bring the pink cursor to the rightmost (33th) position and click >>, the next 33 patterns are shown.

    For program debugging, I connected a file with about 265 patterns, which were created by one of ZUP users in earlier indicator versions and were only used for search. Earlier, patterns were created using external programs, which enabled generation of files in *.CSV format. This is quite a difficult job. Now, patterns can be created by writing their parameters to a CSV file. But it is even easier to use the graphical interface.

  3. Arrows in line  select patern allow selecting groups of patterns set in the ZUP code through the SelectPattern parameter and connecting them to search. But the operation of this parameter depends on whether only ZUP patterns are connected to the search, or patterns from an external file are additionally used. Arrows in  read from file list pattern allow selecting the value of readFromFileListPatterns - "Patterns from ZUP/"Patterns from external file"/"Patterns from ZUP and from file". This parameter sets the place to store patterns. Using arrows in file you can select an external file with the parameters of patterns. This line shows that you can connect file 1 of two 1/2, which is called M. This is a file with the parameters of Merrill patterns.

The New button allows creating a new pattern. If patterns from an external file are connected, buttons Edit and Delete can appear depending on the value selected in line read from file list pattern . If there are no external files, button Edit can appear for built-in ZUP patterns. This option allows creating custom patterns based on the available 33 patterns by editing their parameters.

Below, you can additionally see line add parameter or multiple lines with the values of additional parameters, which are specific for the pattern in the right image.

A click on New opens a list of 8 lines with parameters, which can be set for 5-dot patterns.

list of parameters

A repeated click on New returns the previous screen value. Action of any buttons in the ZUP GUI can be canceled by a repeated click on the same button or by pressing ESC.

A click on one of the lines with the list of parameters opens the following window:

In this case the fifth line was clicked. The image shows an example of a pattern, which can be created using the selected parameters. Values of the initial pattern parameters are used for the default values of parameters of this new pattern. Parameters can be changed. Jokingly, a new pattern was created based on this one Baba yaga:

baba yaga

A repeated click on the fifth line shows the following:

Line  parameters pattern shows editable parameters.

Line parameter shows the selected value of the parameter. The new value of the parameter is selected using arrows. It can be edited manually by clicking 0.382 and editing the parameter value. When a parameter value changes, the graphical presentation of the pattern also changes.

Button Next sets the selected value and brings you to setting the value of the next parameter.

The number of not yet set parameters in line parameters pattern decreases, and the next pattern element BC appears.

Once the first parameter value is fixed by a click on Next , the Back button appears allowing to revert changes and edit the previous values of parameters.

Two buttons  allow you to connect the following parameters at any time: XB line filter and the ratio of the lengths of pattern wings. The ratio is set using arrows. A click on a value selected using arrows allows setting a custom ratio manually. ATTENTION! Set to 0 to disable the ratio.


Once you finish editing the parameters of the new pattern, you will be offered to set its name:

edit name pattern

Let's call it, for example, AA.

After that you will be prompted to select the name of the file to save the newly created pattern to. The file connected as an external file with patterns is selected by default. The file name can be edited; in this case the pattern will be saved to the file with the edited name. If such a file has already been created, the pattern will be added to the end of the list. If the file with this name does not exist, a new file will be created.

Choose/edit file

Editing of pattern parameters is similar to the creation of a new parameter. At the end of the editing, you will be prompted to save the resulting pattern in place of the edited one, or save it as a new pattern in the specified *.csv file. If you have edited a pattern from the built-in ZUP list, you will be offered to save the pattern as a new one in the selected file.

*.csv files are saved to MQL4\Files\ZUP\ListPatterns.

I omit the detailed description of some of the buttons. Their meaning is clear from the above descriptions.

The maximum allowable value can be shown for some parameters you create/edit. It will not be possible to change this value later. This is done in order to avoid setting of such parameter values, which would make the pattern meaningless with the selected ExtDeltaGartley and with the already set values ​​of the parameters. That is, patterns with such values ​​can never be found on the chart. The Ignore button appears. It allows setting any values for the parameter: later we may need to increase the value of ExtDeltaGartley, after which currently not allowed values will become valid.


Part Two. Gartley patterns search parameters

Search for Gartley patterns is enabled using the ExtIndicator=11 parameter. For search, the chart interval of ExtMaxBar bars is scanned. This is the first search option. It is called "Search for patterns with a Scanner".

The search can also be performed with other values of ExtIndicator. In this case, ExtGartleyOnOff parameter is enabled and search is performed on one ZigZag set by the ExtIndicator parameter. This is the second search option: "Searching for patterns on a Zigzag".

When you switch to another timeframe, patterns found using the first two options will be deleted from the chart and a new search will be performed.

There is the third option for finding patterns. This option is described in the article "ZUP - Universal ZigZag with Pesavento Patterns. Graphical interface"

Patterns displayed on a chart using the third option are preserved when you switch to other timeframes. However, the fractal filter may disable their display on some timeframes.

Patterns created using the graphical interface can be used in all three search options.

Below is a complete list of parameters used when searching for Gartley patterns and when working with the graphical interface described in the first part of the article.

for bearish patterns, no bars with a High exceeding a High of a D point development area frame should be present from the D point to a zero bar;

for bullish patterns, no bars with a Low exceeding a Low of a D point development area frame should be present from the D point to a zero bar.

Retracement High and Low set the search range

Files *.csv are located in MQL4\Files\ZUP\ListPatterns.

Files with the screenshots of the found patterns are save to MQL4\Files\ZUP\PicturePatterns.

The *.xml files with the parameters of the found pattern are saved to MQL4\Files\ZUP\XML.

The *.csv files with the parameters of the found pattern are saved to MQL4\Files\ZUP\CSV.

Information about a found pattern can be output to a global variable named "ZUP"+_Symbol+_Period . An example for the global variable name: ZUPGBPUSD240. If a pattern is found, the digit 1 will be written to the variable.

Explanation of some ZUP features implemented in Gartley pattern search modes


Pattern Monitor

The operation of the Pattern Monitor is demonstrated below through the example of the "Chinese toy" mode. A lot of found patterns are displayed on a chart in this mode:

monitor patterns

The Monitor is the lines in the upper left corner of the chart. Each line corresponds to one of the patterns displayed on the chart. The color of the first three columns corresponds to the color of the appropriate pattern. The color of the fourth column: blue means a Bullish pattern set by the ExtColorPatternsBullish parameter, red means a Bearish pattern set by the ExtColorPatternsBearish parameter.

The first column contains the number of the bar on which the pattern's D point is found.

The second column displays minBars/ExtBackstep parameters of the ZigZag, on which the corresponding pattern is found.

The third column shows the conditional deviation of the XC-XB-AD-CD retracements from the ideal value. Let's take a closer look at the specific example of the Bullish Butterfly pattern [1.414/.786/.786/2.0] in the fifth line of the Pattern Monitor. The ideal retracement values ​​are shown in square brackets after the pattern name. How are conditional deviations formed? What do conditional deviations mean?

The larger the number, the greater the deviation from the ideal value.

Equilibrium line and the mirror trend vector line

The Equilibrium parameter enables the display of the equilibrium line, which passes through the pattern's XB points and two reaction lines (red dashed lines):

equilibrium / vector of a mirror trend

Reaction line 1 is parallel to the equilibrium line. The distance between these lines is equal to the distance between the pattern's point C and the equilibrium line.

Reaction line 2 is parallel to the equilibrium line. The distance between these lines is equal to the distance between point A of the pattern and the equilibrium line.

When the price approaches the reaction line, one can expect either correction or end of pattern formation.

The vector of the mirror trend is enabled by the VectorOfAMirrorTrend parameter. After that the drawing of the dashed line begins. The line of the mirror trend vector is pale green in the above image. It is drawn through the diagonal of the potential reversal zone, which is shown as a red rectangle at point D of the pattern.


Part Three. Briefly about other patterns

In addition to Gartley pattern, ZUP allows working with Pesavento patterns and with other types of patterns.

One of such types includes Merrill patterns. They are used in combination with Bollinger Bands. ZUP allows identifying such patterns on an already formed ZigZag. The patterns are not displayed on the chart, while only their names are shown. Dynamic Merrill patterns are formed on the first four ZigZag rays on the right. Patterns on rays 2-5 are static.

Information about Merrill patterns is enabled using parameter infoMerrillPattern=true. Pattern information is displayed in a line in the upper left corner of the chart, in small print. The pattern name can be shown in large print by setting bigText=true. Such large label is displayed in the upper right corner.

Merrill pattern

A dynamic Merrill pattern called Triangle has formed on the first four rays.

A static pattern called M13 has formed on rays from second to fifth.

Merrill patterns are formed of five dots. Their graphical representation can be created using the graphical interface. For example, this has already been done by the forum participant Stanislav Trivailo.

When bigText=true, information about a found Gartley pattern can also be displayed in large print. This information and Monitor can only be displayed for the first two pattern search options.


Conclusions

This brief description will help you understand how to use ZUP to search for patterns.

You can download the ZUP indicator platform on the Market: https://www.mql5.com/en/market/product/19758