Русский 中文 Español Deutsch 日本語 Português
ZUP - Universal ZigZag with Pesavento Patterns. Part 2

ZUP - Universal ZigZag with Pesavento Patterns. Part 2

MetaTrader 4Examples | 2 August 2007, 12:44
23 532 4
Eugeni Neumoin
Eugeni Neumoin

Introduction

Due to the programming language, MQL4, embedded in the MetaTrader 4 Client Terminal it is possible to create various indicators. Some of them may be sophisticated and others may be very simple. It all depends on the developer's imagination. The article describes the way of developing a sophisticated program. It describes, if I may say so, an indicator platform - the ZUP. The article also gives a brief description of graphical tools embedded in the ZUP. ZUP is permanently updated. We describe in this article graphical tools for ZUP_v63.

Pesavento Patterns ( http://www.ensignsoftware.com/tips/tradingtips35.htm#Pesavento )

On the chart below, the ZigZag breaks are joint by dotted lines. A number is given in the middle of each dotted line. These are the dotted lines with numbers near them that represent a tool named Pesavento Patterns. The tool named Pesavento Patterns must be distinguished from the market shapes named Pesavento Patterns. We will explain below what the market shape named Pesavento Patterns represents.


Let us calculate the size of rays 23 and 34 in points. The size of ray 23 = (1.3665-0.8225)*10000=5440. The size of ray 34 = (1.3665-1.1638)*10000=2027. Let us divide: 34/23 = 2027/5440=0.373. We obtain a number that differs from the Fibo 0.382 by 2.46%. You can see the value of 0.382 near the dash line between points of 2 and 4.

The Fibo levels are noticed to start "working" when the market approaches to a certain Fibo level. The market often stops or turns near a Fibo level. There is a kind of an area, within which the market behavior is rather predictable. The size of this area is expressed in percents and equals to 2*Delta.

On the chart below, you can see that a Fibo of 0.382 is near point 4. The Fibo level is below the November minimum by (1.1638-1.1557)*10000=51 points.



EURUSD has not reached Fibo 0.382 a little in November 2005 and turned up. This is how Fibo 0.382 "works". Generally, the number shown near to the dash line is equal to the size of the subsequent ray divided by the size of the preceding ray of ZigZag. In the above example, the ratio of rays is 34/23. This ratio is named retracement between points 2 and 4 of ZigZag.

So why is number 0.382 shown near the line, not 0.373? It was noticed that quite certain Fibo levels "work" on the market. It means there is a certain set of "working" Fibo levels. Different authors give different sets of Fibo levels.


Pesavento Patterns Tool Operation Algorithm

First, the retracements between ZigZag's peaks and troughs. Then the calculated values will be compared to the predefined set of Fibo levels. If the value obtained is other than that from the set of Fibo levels but no more than by Delta%, the number from the set of Fibo levels will be shown near the dash line. The number is colored as it is defined for numbers from the set of Fibo levels. (If the set of Fibo levels corresponds with the numerical table developed by Larry Pesavento, we will obtain the market shape named Pesavento Pattern.) If the obtained number differs from that in the set of Fibo levels by more than Delta%, the former will be displayed near the dash line and colored differently.

Where the tool named Pesavento Patterns is available, there is no need to calculate retracements. If the price is covered by a Fibo level, the Pesavento pattern will display the value of this Fibo level colored as predefined. The tool named Pesavento patterns will deliver one from retracements calculating routines.

The indicator's inputs to work with Pesavento patterns:

  • ExtHidden

    0 - Pesavento patterns are not shown. But other tools can be displayed.
    1 - shows all lines between the ZigZag's peaks or troughs having the retracement percentage>0.1 and <9.36.
    2 - shows only lines having the retracement percentage equaling to a value in the selected set of Fibo levels.
    3 - shows numbers listed in clause 2 plus all dotted lines between the ZigZag's peaks and troughs.
    4 - shows numbers that are not equal to values from the selected set of Fibo levels, as well as the corresponding joining lines.
    5 - shows the ZigZag only. All other tools are hidden. (All tooling is hidden.)

We will call tools attached to ZigZags 'tooling'.

  • ExtFiboZigZag - allows to show the tool named "ZigZag Fibonacci"



  • ExtFractal - the amount of ZigZag maximums/minimums, from which the lines go to other maximums/minimums of the ZigZag.
  • ExtFractalEnd - the amount of maximums/minimums, to which the lines come. No joining lines will be there after this maximum/minimum.

Maximums/minimums are counted starting with zero bar.


  • ExtFractalEnd - if it is 0, the joining lines go up/down to the latest, including zero bar, ZigZag break. The minimal value of ExtFractalEnd is 1.
  • ExtDelta - (tolerance or Delta) deviation in calculations. It also sets the value of a potential pivot area. It must be as follows: 0 < ExtDelta < 1.
  • ExtDeltaType - choose algorithm to calculate the tolerance - the Delta.

    0 - shows restore percentage "as is", with two decimal places.
    1 - calculates tolerance according to the following formula: (retracement-a number from the selected set of Fibo levels).
    2 - calculates tolerance according to the following formula: (retracement-a number from the selected set of Fibo levels)/(a number from the selected set of Fibo levels).
    3 - shows restore percentage "as is", with three decimal places.

    Larry Pesavento says that it is sufficient to set the tolerance within the range of 4% (0.04). When the price enters the tolerance area, the numbers becomes the number from the selected set of Fibo levels and is colored as the number from the selected set of Fibo levels.

  • ExtSizeTxt - select font size for displaying of numbers
  • ExtLine - select color of joining lines
  • ExtPesavento - select color of numbers from the selected set of Fibo levels
  • ExtGartley886 - select color for additional numbers
  • ExtNotFibo - select color for all other numbers in Pesavento patterns
  • ExtPPWithBars

    0 - shows the value of retracement in Pesavento patterns
    1 - shows the value of retracement in Pesavento patterns and displays in brackets the amount of bars between ZigZag peaks for this given retracement.
    2 - shows the value of retracement in Pesavento patterns and displays in brackets the amount of bars between ZigZag peaks individually for the fisrt and for the second ZigZag rays.
    3 - shows in brackets the time retracement after the price retracement. The time retracement is calculated as ratio between the amount of bars on the second ZigZag ray and that on the first ZigZag ray.
    4 - shows in brackets the time retracement calculated as ratio between the second ray development time and the first ray development time.
    5 - shows in brackets the ratio between areas of rectangles constructed on two neighboring rays of ZigZag. ZigZag rays are diagonals of these rectangles.
    6 - shows in brackets the amount of points and percents, by which the current price of ZigZag break differs from the number from the selected set of Fibo levels (or from the corresponding Fibo level). For example, 2. 618 (7/2.81%). Number 7 in brackets means that the Fibo level of 2.618 goes 7 points or 2.81% above the bar maximum. If 7 is negative, the Fibo level of 2.618 goes 7 points below the bar maximum.

Pesavento patterns have the same functionality as the tool named Fibo levels.


Sets of Fibo Levels for Different Symbols

In the ZUP, sets of Fibo levels are divided into a standard set and alternative sets. We will also call the alternative set of numbers Pesavento numbers.

Using parameter ExtFiboType, you can choose between the standard set of Fibo levels and an alternative set of Fibo levels:

  • ExtFiboType = false - the standard set of Fibo levels is shown
  • ExtFiboType = true - an alternative set of Fibo levels is shown
  • ExtFiboChoice - specifies the set of alternative Fibo levels

The full list of Fibo levels (numbers) for different symbols embedded in the ZUP is given below.

  • Pesavento patterns

    ZUP versions through version 58:
    Standard set of Fibo levels: 0.146-0.236-0.382-0.5-0.618-0.764-0.854-1.0-1.236-1. 618
    Pesavento numbers: 0.146-0.236-0.382-0.447-0.5-0.618-0.707-0.786-0.841-0.886-1. 0-1.128-1.272-1.414-1. 5-1.618-1.732-1.902-2.0-2.236-2.414-2.618-3.14-3.618-4.0

    In version 59, it is possible to choose between alternative sets of numbers.

  • Standard Set of Fibo Levels

    0.146 - 0.236 - 0.382 - 0.5 - 0.618 - 0.764 - 0.854 - 1.0 - 1.236 - 1.618 - 4.236

  • Alternative Sets of Fibo Levels

    ExtFiboChoice = 0 - set of Larry Pesavento's numbers: 0.25 - 0.382 - 0.5 - 0.618 - 0.707 - 0.786 - 0.841 - 1.0 - 1.128 - 1.272 - 1.414 - 1.618 - 2.0 - 2.618 - 4.0
    ExtFiboChoice = 1 - a set of numbers used to build Gartley patterns: 0.382 - 0.447 - 0.5 - 0. 618 - 0.707 - 0.786 - 0.886 - 1.128 - 1.272 - 1.414 - 1. 618 - 2.0 - 2.236 - 2. 618 - 3.142 - 3.618
    ExtFiboChoice = 2 - a set of numbers used to build Gartley patterns plus additional useful numbers. Numbers can be later added here. As for now, the following extra numbers are included: 0.146 - 0.236 - 0.854 - 1.732 - 1.902
    ExtFiboChoice = 3 - a set of numbers that Bryce Gilmore pointed out in the general list of numbers in his book Geometry of Markets 2 [5;6] as the most important ones: 0.25 - 0.382 - 0.5 - 0.618 - 0.667 - 0.786 - 1.0 - 1.272 - 1.618 - 1.732 - 1.75 - 2.0 - 2.236 - 2.5 - 2.618 - 3.0 - 3.33 - 4.236 - 6.854

    Bryce Gilmore in his book Geometry of Markets 2 divides numbers into groups. Below are sets of numbers taken from Bryce Gilmore's book as John Edwards suggests on Onix forum.

    ExtFiboChoice = 4 - set of numbers Geometric 0.146 - 0.186 - 0.236 - 0.3 - 0.382 - 0.486 - 0. 526 - 0.618 - 0.786 - 1. 0 - 1.272 - 1.618 - 1.902 - 2.058 - 2.618 - 3.33 - 4.236 - 5.388 - 6.854
    ExtFiboChoice = 5 - set of numbers Harmonic 0.125 - 0.177 - 0.25 - 0.354 - 0.5 - 0.707 - 1.414 - 2.0 - 2.828 - 4.0 - 5.657 - 8.0
    ExtFiboChoice = 6 - set of numbers Arithmetic 0.167 - 0.333 - 0.577 - 0.667 - 1.5 - 1.732 - 3. 0 - 6.0
    ExtFiboChoice = 7 - set of numbers Golden Mean 0.236 - 0.30 - 0.486 - 0.618 - 0.786 - 1.272 - 1.618 - 2.058 - 2.618 - 3.33
    ExtFiboChoice = 8 - set of numbers Square 0.177 - 0.250 - 0.354 - 0.50 - 0.707 - 1.414 - 2.0 - 2.828 - 4.0 - 5.656
    ExtFiboChoice = 9 - set of numbers Cube 0.111 - 0.192 - 0.333 - 0.577 - 1.732 - 3.0 - 5.2 - 9. 0
    ExtFiboChoice = 10 - set of numbers Rectangle (Root 5 by Bryce Gilmore) 0.20 - 0.447 - 2.236 - 5.0
    ExtFiboChoice = 11 - set of numbers Extra Useful Numbers 1.414 * 1.618 = 2.288, 1.414 * 0.618 = 0.874, 2.618 * 1.272 = 3.330, 2.618 * 1.618 = 4.236, 1.618 / 2 = 0.809, 2.618 / 2 = 1.309, 1. 618 * 2 = 3.236, 1.732 * 2 = 3.464, 2.236 * 2 = 4.472

  • Fibo Levels and Expansions as Described by Robert Fisher [6], but in a Bit Different Way

    Standard numbers: 0-0.146-0.236-0.382-0.5-0.618-0.764-0.854-1.0-1.236-1.618-2.618-4. 236-6.854
    Pesavento numbers: 0-0.382-0.5-0.618-0.707-0.786-0.854-0.886-1.0-1.128-1.272-1. 414-1.618-2.0-2.414-2. 618-4.0

  • Fibonacci Expansions as in MetaTrader

    Standard numbers: 0.236-0.382-0.5-0.618-0.764-0.854-1.0-1.236-1.618-2.0-2.618
    Pesavento numbers: 0.382-0.5-0.618-0.707-0.786-0.886-1.0-1.272-1.414-1.618-2.0-2. 618

  • Fibo Fans. Static Fibo Fans Are Shown with Static Andrews' Pitchfork. The Dynamic Ones Are Shown on the First Ray

    Standard numbers: 0.236-0.382-0.5-0.618-0.764-0.854
    Pesavento numbers: 0.236-0.382-0.5-0.618-0.786-0.886

  • Fibo Fans on Random Points and along the Andrews' Pitchfork Midline

    Standard numbers: 0.236-0.236-0.382-0.5-0.618-0.764-0.854-1.0:1.618-2.618
    Pesavento numbers: 0.382-0.5-0.618-0.707-0.786-0.886-1.0-1.272-1.414-1.618-2.618

  • Reaction Lines (RL)

    Standard numbers: 0.236-0.382-0.5-0.618-0.764-1.0-1.618-2.0-2.618-4.0
    Pesavento numbers: 0.382-0.5-0.618-0.707-0.786-0.886-1.0-1.128-1.272-1.414-1.618-2. 0-2.414-2.618-4. 0

  • Warning Lines (UWL and LWL)

    Standard numbers: 0.618-1.0-1.618-2.0-2.618

  • Fibo Time

    Standard numbers: 0-1-1.236-1.382-1.5-1.618-1.764-1.854-2.0-2.236-2.618-3.0-2.618
    Pesavento numbers: 0-1-1.382-1.5-1.618-1.707-1.786-1.886-2.0-2.272-2.414-2.618-3. 0-3.414-3.618-4. 0

  • Versum Levels

    Standard numbers - 23.6-38.2-45.5-50.0-54.5-61.8-76.4
    With Pesavento numbers - 23.6-38.2-44.7-50.0-61.8-78.6-88.6

This list can be modified in future.


Numbering of ZigZag Breaks and Rays

Many tolls in indicator are based on a certain ray or a certain break of ZigZag. For instance:

  • ExtFiboStaticNum - number of the ZigZag ray, on which the static Fibo levels will be built.
  • ExtFiboExpansion - Fibo expansions as in MetaTrader - it specifies the ZigZag break where the first point of Fibo expansion is located.

The chart below shows numbering of breaks in red, numbering of rays - in Teal.



If some drawings are made on the first ray or on zero (0) break, the tool will be dynamically changed together with the current price changes. If the shapes do not touch the first ray or zero break, the tool won't change and, correspondingly, this tool will be called static. All graphical tools in the ZUP are built on the first nine rays or on the first ten peaks (0-9). But Pesavento patterns can be built on all breaks, not only on the first ten ones.

Dynamic and Static Fibo Levels. Fibo Expansions

Graphical tools embedded in the ZUP can be dynamic or static. Static graphical tools are anchored to ZigZag breaks already formed, i.e., to the breaks that won't change anymore. Dynamic graphical tools are anchored on the end of the ZigZag first ray that always changes its location.

Dynamic graphical tools allow to make a quick decision. If the market turns, we will be able to see the possible trend looking at the shape of the dynamic graphical tool. As soon as the first ray of ZigZag changes, the dynamic graphical tool will be automatically rebuilt, too.

Dynamic Fibo levels are built on the first, changing ray of ZigZag:



Static Fibo levels are built on rays 2-9.




Parameters to be used for working with Fibo levels:

  • ExtFiboType = true - Fibo levels with Pesavento numbers, false - standard Fibo levels
  • ExtFiboDinamic - allows to display dynamic Fibo levels. The dynamic Fibo levels will be shown on the first ray of Zig Zag
  • ExtFiboStatic - allows to display static Fibo levels
  • ExtFiboStaticNum - ZigZag ray number, from which the static Fibo levels will start to be shown
  • ExtFiboS and ExtFiboD - select color for static and dynamic Fibo levels

At that, the Fibo level value, for example, 61.8 is shown, the price for the corresponding Fibo levels and the name of timeframe, on which the Fibo levels are shown. It is important to know the timeframe when working in the DT mode. The values of dynamic Fibo levels are shown closer to the chart window border. The values of static Fibo levels are shown with an indent from the border.

When static and dynamic Fibo levels are shown simultaneously, the values of Fibo levels will be partly overlapped. This may complicate information viewing. However, MetaTrader 4 does not allow showing static Fibo levels at some distance from a chart window border. Dynamic Fibo level will be automatically changed with the first ZigZag ray changing in size or location.

  • ExtFiboCorrectionExpansion switches static and dynamic Fibo levels to show corrections or Fibo expansions.

Fibonacci expansions will be shown as described in Robert Fisher's book of The New Fibonacci Trader [6]. At that, the size of the ZigZag ray is considered as basis. Expansions are seeming to prolong the ray. Expansion numbers as by Robert Fisher are shown with prefix Fe.


  • ExtFiboExpansion - Fibo expansions as in MetaTrader 4 - sets the ZigZag break where the first of three Fibonacci expansion points is located.

    ExtFiboExpansion<2 - Fibo expansions are not displayed
    ExtFiboExpansion=2 - dynamic Fibo expansion
    ExtFiboExpansion>2 -


Andrews' Pitchfork ( http://www.trading-naked.com/alan_andrews_course_1.htm )

Andrews' Pitchfork and tactics used to work with this tool were described by Patrick Mikula (http://www.mikulaforecasting.com/books/aabook.htm). Putnik has also made a detailed description of how Andrews' Pitchfork can be built, on ONIX forum at: http://onix-trade.net/forum/index.php?showtopic=8249 Building of Andrews' Pitchfork was realized in the ZUP by Putnik's request, as well.

The full list of parameters for working with Andrews' Pitchfork:

  • ExtPitchforkDinamic

    > 0 ( = 1) shows dynamic Andrews' Pitchfork of the last two ZigZag extremums
    = 2 - shows Andrews Pitchfork with a 50-% medianline
    = 3 - shows a 50-% Andrews' Pitchfork (as interpreted by Vinsant, a participant of ONIX forum)
    = 4 - shows Schiff lines

  • ExtPitchforkStatic

    > 0 ( = 1 ) shows static Andrews' Pitchfork of the ZigZag extremum numbered as ExtPitchforkStaticNum
    = 2 - shows Andrews' Pitchfork with a 50-% medianline
    = 3 - shows a 50-% Andrews' Pitchfork (as interpreted by Vinsant)
    = 4 - shows Schiff lines

  • 3 <= ExtPitchforkStaticNum <= 9 - number of the ZigZag peak, from which the static pitchfork starts.
  • ExtLinePitchforkS and ExtLinePitchforkD specifies color for static and dynamic pitchfork.
  • ExtPitchforkStaticColor - specifies color for the static pitchfork fill and enables the filling. Fill is enabled by selection of color and disabled by setting this parameter for NONE.
  • ExtFiboFanDinamic - enables showing of dynamic Fibo fans.
  • ExtFiboFanStatic - enables showing of static Fibo fans.
  • ExtFiboFanExp - the amount of rays for a Fibo fan. True=6, false=4.
  • ExtFiboFanHidden - allows to show the Fibo fans' ray marking. It only processes static and dynamic Fibo fans.
  • ExtFiboFanD - sets color for dynamic Fibo fans.
  • ExtFiboFanS - sets color for static Fibo fans.
  • ExtFiboFanMedianaStaticColor and ExtFiboFanMedianaDinamicColor - sets color for Fibo fans on the medianline of static and dynamic pitchforks and enables the corresponding Fibo fans
  • ExtPitchforkStyle - sets pitchfork output style:

    0 - solid line
    1 - dashed line
    2 - dotted line
    3 - chain-dotted line
    4 - dot-dotted-dashed line
    5-10 - sets the thickness of the solid line

  • ExtFiboTime1 - enables Fibo time zone 1.
  • ExtFiboTime2 - enables Fibo time zone 2.
  • ExtFiboTime1C - sets color for lines of time zone 1.
  • ExtFiboTime2C - sets color for lines of time zone 2.
  • ExtPivotZoneStaticColor - sets fill color for static Pivot Zone.
  • ExtPivotZoneDinamicColor - sets fill color for dynamic Pivot Zone.
  • ExtPivotZoneFramework - specifies showing of Pivot Zone as a frame (by default) or as a filled rectangle.
  • ExtUTL - enables the upper control line of Andrews' Pitchfork.
  • ExtLTL - enables the lower control line of Andrews' Pitchfork.
  • ExtUWL - enables upper warning lines.
  • ExtLWL - enables lower warning lines.
  • ExtISLDinamic - enables internal signal lines for dynamic Andrews' Pitchfork.
  • ExtISLStatic - enables internal signal lines for static Andrews' Pitchfork.
  • ExtRLine - enables showing of reaction lines along Andrews' Pitchfork.
  • ExtRLineBase - hides the directional lines of reaction.

In the Figure below, an exemplary building of Andrews' Pitchfork is given.


Note:

Reaction lines are drawn using Fibo Channels. In many cases, they may be drawn with errors. The errors are insignificant, but they can accumulate on a larger time period. It is impossible to draw them without errors. Standard tool Fibonacci Channels error-free drawing is impossible in MetaTrader 4 due to Fibo Channels' specific anchoring to candlesticks. In my first article, ZUP - Universal ZigZag with Pesavento Patterns. Part 1, I wrote about this error. This is why the Reaction Lines in the current realization should be used with care. This error can only be fixed by MetaTrader 4 developers.

  • ExtPitchforkCandle - includes showing of the set of pitchforks from the selected candlesticks
  • ExtPitchfork_1_HighLow - when pitchfork is built on the selected candlesticks, it specifies building of the pitchfork's first point on the maximum or minimum of the candlestick
  • ExtDateTimePitchfork_1, ExtDateTimePitchfork_2, ExtDateTimePitchfork_3 - specifies date and time for candlesticks, on which Andrews' pitchfork will be built for the first, the second, and the third point, respectively

How to Show A Set of Pitchforks on the Selected Candlesticks

Let us select candlesticks, on which we will show the pitchfork. Let us point the mouse over these candlesticks. Then write down the date and time of the candlesticks on a separate sheet of paper and after that, call the dialog box to change the indicator's parameters. In parameters ExtDateTimePitchfork_1, ExtDateTimePitchfork_2, ExtDateTimePitchfork_3, enter date and time of candlesticks. Using ExtPitchfork_1_HighLow, decide whether we will build the first point of the pitchfork from maximum or from minimum. Set ExtPitchforkCandle = true. Using ExtPitchforkCandle, decide whether the set of pitchforks will be built on ZigZag extremums or on the extremums of the selected candlesticks.

When selecting ExtPitchforkStatic>0, the set of static pitchforks will be built on the selected candlesticks and displayed on the screen. The set of pitchforks can be saved. If the pitchfork's third point is located on zero bar, dynamic pitchfork will be displayed, which cannot be saved.
The example below shows how Andrews' Pitchfork can be built on the selected candlesticks. Candlesticks, to which the pitchfork is anchored, are default ones in the ZUP. The screenshot is made using ZUP_v63. In earlier versions, reaction lines RL*** are built in this chart with errors due to features of Fibonacci Channels in MetaTrader 4. Reaction lines are built using Fibnacci Channels.

Parameter ExtSave allows saving of the set of static pitchforks, Fibo Time, Fibo Expansions, and static Fibo levels. This parameter does not save filling of the channel of static pitchfork.

How to work with ExtSave:

  1. The set of Andrews pitchforks and all auxiliary lines should be built.
  2. Open the indicator setup panel and set ExtSave=true.
  3. Close the setup panel. The set of pitchforks will be drawn in the chart.
  4. Re-open the indicator setup panel and set ExtSave=false.
  5. Close the panel. The saved set of pitchforks will be shown in the chart. The same set of pitchforks will be displayed over the previous set, but the second set (shown over the first one) will be deleted together with the indicator while the first one will remain in the chart.

If clauses 4 and 5 are not performed, the actual set of pitchforks with its current parameters will be saved in the chart at each change of the indicator parameters. If the indicator is deleted, a number of sets of pitchforks will remain in the chart, superimposed upon each other or a bit shifted.

The tools (pitchfork, fans, etc.) should be saved on the smallest of actual timeframes. If they are saved on a larger timeframe and when you switch to a smaller timeframe, the tools saved will be drawn starting from the first candlestick of the smaller timeframe, this candlestick timely included in the larger timeframe, the timeframe where the tools have been saved. This is one of MetaTrader 4 features, too. When switching to another timeframe, the saved tools will be shown with errors.

If you don't save the tools, but just show them using ZUP, they will be built properly. In the DT mode of the ZUP, the ZigZag breaks are recalculated and breaks are built on the candlesticks where maximum or minimum really takes place when changing the timeframe. So the tools are re-anchored to more precise points. Drawing defects were not observed at that.


micmed's Channels

micmed's Channels are a new graphical tool developed by micmed, a participant of ONIX forum. It is based on Andrews' Pitchfork, but anchoring points of the pitchfork are selected in a special way.

Below are micmed's quotations from some posts on ONIX forum (translated into English by MetaQuotes Software Corp.):

...such as shown in the screenshots can also be added to the set of pitchforks, I call them "golden section". Trying VL (*), I discovered that such pitchforks retained proper channels most frequently...

This is what explains the interest in this drawing: the golden section built according to the above requirements works further as a channel, though it is built far before the borders of a classical channel are shown. And this fits completely in the harmony related to Fibonacci numbers...

...these are not pitchforks, really, it was just comfortable to build using them. As to the building, I put point 1 on a vertical line built from B. Some observations are given below:

  1. If diagonal line AB is shorter than diagonal line BC, I build at a distance of 32, 8% from vertex B
  2. If diagonal line AB is longer than diagonal line BC, then 61.8% from vertex B
  3. There are also 50%, usually at pivots, and they follow each other, 2-3 triangles
  4. If the channel is broken through, point 38.2 will change for 61.8 and vice versa (screenshots)

* - VL - Versum Levels -a new graphical tool to be described later.

Parameters:

  • ExtCM_0_1A_2B - enables drawing of micmed's channels. The value should be chosen among numbers of 1-2-3-4. The default value of 0 means that normal Andrews' Pitchfork will be built.
  • ExtCM_Fibo - sets the Andrews' Pitchfork median line location to draw micmed's channels. The value can vary from 0 to 1.

Parameter ExtCM_0_1A_2B anchors all Andrews' pitchforks (see above) to other points. To draw micmed's channels, you should build Andrews' pitchforks first. Then, using parameter ExtCM_0_1A_2B, select new anchoring points for pitchforks. The value of parameter ExtCM_0_1A_2B depends on lengths of AB and BC.

Below is the author's description of how channels can be drawn:

micmed's channels in the ZUP, starting from version 55 are built using standard tool named Andrews' Pitchfork on three points, points 2 and 3 being selected on two peaks, like in classical pitchforks, whereas point 1 being selected by two parameters:

  • ExtCM_0_1A_2B (can be 0, 1, 2, 3, 4) defines vertical line, on which point 1 will be located

    respectively, if
    0 - micmed's channels are not drawn, a standard pitchfork is drawn
    1 - point 1 is selected on the vertical line from peak A along Fibo levels AB
    2 - point 1 is selected on the vertical line from peak B along Fibo levels BC
    3 - point 1 is selected on the vertical line from peak A along Fibo levels BC
    4 - point 1 is selected on the vertical line from peak B along Fibo levels calculated according the following algorithm: if AB>BC, then the value is 0.618; if AB<BC, then the value is 0.382

  • ExtCM_Fibo (may vary from 0.0 to 1.0) defines the value for Fibo level of point 1

Exemplary drawings:

  • ExtCM_0_1A_2B = 1, ExtCM_Fibo = 0.618





  • ExtCM_0_1A_2B = 2, ExtCM_Fibo = 0.618





  • ExtCM_0_1A_2B = 3, ExtCM_Fibo = 0.382





Analyzing history on EURUSD, Daily starting from year 1989 - ZUP_v54 with parameters of Extindicator=6, minBars=25 - there were 103 triangles built where

  • if AB>BC, point 1 is selected on the vertical line of peak B on the value of 0.618 (31 triangles)
  • if AB < BC, point 1 is selected on the vertical line of peak B on the value of 0.382 (31 triangles)

it was also observed that in broken channels Fibo values for point 1 change from 0.382 to 0.618 and vice versa (trend direction change), as well as value 0.5 at flats (40 triangles).

Mode 3 is useful for very fast peaks. Otherwise, the channel will be at a very acute angle...

I would like to share an important, to my point of view, observation. In channel building mode 4 (perhaps, in others, too, but this one is automated), price ALWAYS(!) reaches the price at the level of intersection of RL 161.8 with the channel median line and practically always within the range of RL 100 - 161.8.

Above are some quotations from micmed's posts. This was done to for better understanding of how the new graphical tool, micmed's Channels, works. Fibo levels are displayed in the chart in order to show the building algorithm of the Channels. The ZUP containing this graphical tools does not show Fibo levels.

Versum Levels

This graphical tool was developed by versum, the participant of forums at KBPauk and ONIX. It is quite possible that this tool has also been implemented by others. In ZUP, this tool is named Versum Levels.

Parameters:

  • ExtVLStaticColor - enables static Versum Levels by selecting color
  • ExtVLDinamicColor - enables dynamic Versum Levels by selecting color
  • ExtVLStaticNum - sets the peak number, on which the static Versum Levels will be displayed

This tool complements Andrews' Pitchfork and resembles Fibo Fan. Like Andrews' Pitchfork, it works around the median line. Andrews' Pitchfork median line coincides with 50-% level of VL. Below is a sample of how a dynamic VL is drawn. Fibo levels are displayed in the chart in order to show how this graphical tool is built. The ZUP containing this graphical tools does not show Fibo levels.



Below are some quotations from versum's posts (translated into English by MetaQuotes Software Corp.):

This can be considered both a fan, i.e., radiating lines, and a Fibo Fan since I use a segment that intersects these lines and is divided into parts by Fibo level (a tool being at hand and that moment)... In Fig. 1, you can see that segment BC is divided into parts using a Fibo level. Lines are drawn from the preceding peak/trough, point A, through the points of intersection of the Fibo level and segment BC. These are the expected price levels.

So what we have?

  1. levels (which is most important) that change with the time
  2. these are these variations, from which Gartley Patterns and other shapes and models develop, but they are visible "after"
  3. expected trend development.

How to use it?

If the price touches or exceeds the level of the 50-% line (that passes through the point divided by 50-% level), so we can say (though not with a 100-% probability) that the trend keeps the same direction. If it is below 50-% line, we can say that the current trend may change...

Notes:

  1. I do not use the obtained levels strictly, up to 1 pip. I think this should rather be considered as an area.
  2. I do not consider Fibo levels to be a panacea either. Other ratios between parts of the segment may turn to be better.

Independent Fibo Fans

Along with Fibo Fans that work together with Andrews' Pitchfork, it is possible to enable independent Fibo Fans. These Fibo Fans are displayed on the first nine rays of ZigZag or on the first ten extremums of ZigZag. They are enabled by selecting color using parameter ExtFiboFanColor. The Fans are arranged by parameter ExtFiboFanNum.

Enhanced Mode

The market analysis is most effective when ZigZag peaks and troughs belong to the same wave level. It frequently happens that ZigZag identifies peaks and troughs being "excessive" for a wave level. It is undesirable to build tools embedded in the ZUP on those "excessive" extremums. Well, this topic needs a special research and is open to discussions...

The enhanced mode is created especially to build tools on "right" extremums. The following tools can work in the enhanced mode:

  1. Static Pitchfork
  2. Static Fibo Levels
  3. Static Fibo Expansions
  4. Independent Fibo Fans
  5. Versum Levels
  6. Micmed's Channels

The set of Andrews' pitchforks is everything concerning pitchforks. Lines of the set of pitchforks are anchored to certain points of the pitchforks. For example, control lines are drawn from the first, initial point of the pitchfork through the second and the third one. In the enhanced mode, all lines will be anchored to the corresponding points of the pitchfork wherever those points are located.

If you set parameters of all five tools that can work in the enhanced mode in the same way as before, there will not be any differences from that what you have had before.

In the enhanced mode:

  1. For static pitchforks,you will have to specify three peaks instead of only one number that showed the first peak, on which the pitchfork is built. This will look, for example, like this: ExtPitchforkStaticNum=741.





    Here, peak 7 corresponds with the first point of the pitchfork, trough 4 does with the second point of the pitchfork, peak 1 - with the third point of the pitchfork. The 50-% median line, in this case, is built from the midpoint of the segment that joins points 1 and 2 of the pitchfork ( ZigZag extremums 7 and 4), and goes through the midline of the segment joining points 2 and 3 of the pitchfork (ZigZag extremums 4 and 1). The reaction lines are anchored to points 2 and 3 of the pitchfork.

    If the last digit in parameter ExtPitchforkStaticNum is above 0, static pitchfork will be displayed. If it is 0, the pitchfork built will be dynamic. But, as soon as a new ZigZag ray appears, the pitchfork will become static. If you change any parameters of the indicator during its turning from dynamic to static, the dynamic pitchfork will be displayed again.

    Important: Digits (741) must interchange peaks and troughs. A pitchfork cannot be built if two peaks or two troughs are specified consecutively. It means odd and even numbers must alternate.

  2. For static Fibo levels in the enhanced mode, in the parameter should be specified two ZigZag extremums, on which the Fibo level will be built. For example, ExtFiboStaticNum=72.





  3. Static Fibo Expansions should be built on three ZigZag extremums in the enhanced mode. Example: ExtFiboExpansion=721.





    In the above example, Fibo Expansions will be built as they are drawn in MetaTrader 4. But, if Fibo levels are shown (tool 2) and ExtFiboCorrectionExpansion = true, the Fibo Expansions will be shown instead of Fibo levels. In this case, however, the expansions will be built on two points and correspond with those described in the Robert Fisher's book [6].

  4. Independent Fibo Fans are built on two extremums in the enhanced mode. Example: ExtFiboFanNum=74





  5. Versum Levels:





  6. Micmed's Channels:





Below is what I would like to emphasize again:

For all tools, peaks and troughs must be alternated i the enhanced mode. The tool cannot be built for two consecutive peaks or troughs. Under "consecutive" I mean two consecutive digits that define extremums in a parameter.

All tools in the enhanced mode can be both static and dynamic. If the last digit in the defined parameter is 0, the tool will change dynamically.

Fibonacci Arcs

In ZUP_v63, it becomes possible to build Fibonacci Arcs. All further parameters in the article are parameters as in ZUP_v63.

Parameters:

  • ExtArcDinamicNum - sets the number of ZigZag breaks, to which the dynamic Fibo Arcs will be built;
  • ExtArcStaticNum - sets the number of ZigZag breaks, on which the static Fibo Arcs will be built;
  • ExtArcDinamicColor - sets color for dynamic Fibo Arcs;
  • ExtArcStaticColor - sets color for static Fibo Arcs;
  • ExtArcDinamicScale - sets scaling of dynamic Fibo Arcs: 0 - auto scale; >0 - custom scale;
  • ExtArcStaticScale - sets scaling of static Fibo Arcs: 0 - auto scale; >0 - custom scale.

Arcs have two anchoring points.

  • For parameter ExtArcStaticNum=21:

    2 - central point of a static arc, it shows the number of the ZigZag peak/trough
    1 - 100-% point of the arc, it shows the number of the ZigZag peak/trough, too

  • For setting of ExtArcStaticNum=12

    1 - central point
    2 - 100-% point

If, for example, you set ExtArcStaticNum=3, the center will be located on break 3 of the ZigZag and 100% will be on break 2.

If you set ExtArcStaticNum=83, the center will be on break 8, and 100% - on break 3. The center and 100% can also be defined between two peaks or troughs, for example: ExtArcStaticNum=42.

Static arcs can be drawn between any two ZigZag breaks, from break 1 through break 9. Dynamic arcs are built between "break" 0 and any of the consequent 9 breaks.

If you set ExtArcDinamicNum=8, the center will be in point 0 of the ZigZag, 100% - on break 8. If you set ExtArcDinamicNum=80, the center will be on break 8, 100% - on point 0.

The arc is calibrated along the ZigZag ray, on which it was built. It is meant by ray the line that joins the central point with the 100-% point of the arc, so the points the arc is anchored to. It is calibrated automatically using parameters ExtArcDinamicScale=0 and ExtArcStaticScale=0. The calculations are automated and performed as follows: The amount of points between the central point and the 100-% point of the arc is calculated and then divided by the amount of bars between these points. The obtained number defines the scaling value when drawing arcs. Thus, the arcs are scaled.

If you write in parameters ExtArcDinamicScale and ExtArcStaticScale a number exceeding 0, then the arc will be calibrated (scaled) with this number.

Indicator's Optionality

Using ZigZag ExtIndicator = 1, ExtIndicator = 2 and ExtIndicator = 3 and parameter chHL=true, you can show acknowledge levels in the chart. The acknowledge levels display the channel. If the price breaks the opposite side of the channel, the ZigZag will draw a new ray.

Using parameter PeakDet = true, the levels of preceding ZigZag minimums and maximums are shown.

Parameters chHL and PeakDet are taken from the original Alex's ZigZag.

  • chHL_PeakDet_or_vts - If it is true - by default, it allows the output of acknowledge lines (price channel) and the levels of preceding ZigZag maximums. If it is false, indicator i-vts will be displayed. If you set false, two copies of indicator i-vts with different settings will be displayed on the screen.
  • NumberOfBars - the amount of bars to be calculated (0-all bars) for i-vts.
  • NumberOfVTS - this is, so far I can judge, a smoothing parameter for i-vts.
  • NumberOfVTS1 - smoothing parameter for the second copy of i-vts.

General Options

  • ExtObjectColor - sets color for the line that joins basic points of graphical objects;
  • ExtObjectStyle - sets style for the line that joins basic points of graphical objects;
  • ExtObjectWidth - sets thickness of the line that joins basic points of graphical objects.

These three parameters work with Fibo levels, Fibo Expansions, Fibo Arcs, and FiboTime zones. Previously, basic points of these objects were joint by a red dotted line. These three parameters work with all above-listed objects simultaneously.

  • ExtSendMail - allows sending of an email message about the pattern appeared;
  • ExtAlert - allows messaging and sound alerting when a new ZigZag ray appears;
  • ExtBack - sets showing of all objects in the background;
  • infoTF - enables showing of information about 5 larger timeframes. It shows the following: Timeframe name, candlestick size in points, the current state of price related to the minimum. It also shows the height of the first ZigZag ray in percents. And it shows names of Gartley Patterns and the size of the possible D-point development zone for Gartley Patterns.



Conclusion

The article describes the main features of tools embedded in the ZUP:

  1. Pesavento Patterns;
  2. set of tools working with Andrews' Pitchfork;
  3. Fibonacci Fans;
  4. Fibonacci Levels;
  5. Fibonacci Arcs;
  6. two variations for Fibonacci Expansions.

The new tools are described: Versum Levels and micmed's channels. The full list of values Fibo levels used in various graphical tools. ZUP parameters are briefly described, as well.

I continue to enhance the functionality of ZUP. It is not impossible that in future the features of tools already available will be enhanced and some new tools will be embedded. New parameters are continuously added, as well. I also find and fix various errors. The further developments of the ZUP are performed on ONIX forum at: http://onix-trade.net/forum/index.php?showforum=54

It is very difficult task to complete the description since new features are permanently added to the ZUP. As of now, ZUP_v64 has already been issued. In this latest version, the features that allow working with micmed's channels are enhanced, it is now possible to work with custom Fibo levels, etc. Two new ZigZags have been added, too: ExtIndicator=12 - ZigZag developed by Talex, and ExtIndicator=13 - ZigZag developed by Tovaroved.

Attached to the article are ZUP_v63 and ZUP_v64. ZUP_v64 is also provided with a brief description of novelties (as a MS Word file).

List of References

  1. Larry Pesavento. Fibonacci Ratios with Pattern Recognition
  2. Larry Pesavento. Profitable Patterns for Stock Trading
  3. Bryce Gilmore. Dynamic Time and Price Analysis of Market Trends
  4. Bryce Gilmore. Geometry of Markets
  5. Bryce Gilmore. Geometry of Markets 2
  6. Robert Fisher. Novie metodi torgovli po Fibonacci (Robert Fisher. The New Fibonacci Trader, translated into Russian)


Translated from Russian by MetaQuotes Ltd.
Original article: https://www.mql5.com/ru/articles/1470

Attached files |
ZUP_v63.zip (41.68 KB)
ZUP_v64.zip (46.24 KB)
Last comments | Go to discussion (4)
[Deleted] | 11 Oct 2008 at 23:24

Nice work...the programming is quite complex.....and so are the uses. How do Imake the indicator stop redrawing? tanx

felipeawolff
felipeawolff | 15 Apr 2011 at 17:43
hello everybody! thoroughly enjoyed your work and think you're a very talented programmer!

I want your help for setting up a bookmark with triangles, as shown in the figure below, three signals using fractals. being a first fractal down to the first tip of the triangle and other fractal up to the second point, ending with a fractal down to a value 50% higher than the first signal.

already thanks Felipe Wolff


http://forum.mql4.com/40261


[Deleted] | 16 May 2014 at 16:08
osaze:

Nice work...the programming is quite complex.....and so are the uses. How do Imake the indicator stop redrawing? tanx

If there exists a real non-repainting ZigZag indicator, then it means that the Forex market is predictable! Thus, there is no way to stop the indicator from redrawing unless you accept a non-perfect ZigZag shape (false signals) on the chart.
David Gadelha
David Gadelha | 20 Aug 2016 at 20:18
Is there a way to convert this code to mql5?
Price Forecasting Using Neural Networks Price Forecasting Using Neural Networks
Many traders speak about neural networks, but what they are and what they really can is known to few people. This article sheds some light on the world of artificial intelligence. It describes, how to prepare correctly the data for the network. Here you will also find an example of forecasting using means of the program Matlab.
Strings: Table of ASCII Symbols and Its Use Strings: Table of ASCII Symbols and Its Use
In this article we will analyze the table of ASCII symbols and the ways it can be used. We will also deal with some new functions, the principle of operation of which is based on the peculiarities of the ASCII table, and then we will create a new library, which will include these functions. They are quite popular in other programming languages, but they are not included into the list of built-in functions. Besides, we will examine in details the basics of working with strings. So, I think you will certainly learn something new about this useful type of data.
Practical Use of the Virtual Private Server (VPS) for Autotrading Practical Use of the Virtual Private Server (VPS) for Autotrading
Autotrading using VPS. This article is intended exceptionally for autotraders and autotrading supporters.
Testing Visualization: Account State Charts Testing Visualization: Account State Charts
Enjoy the process of testing with charts, displaying the balance - now all the necessary information is always in view!