You are on page 1of 23

1. vchaganti7@gmail.

com

The Zigzag Trend Indicator


Nov 2003 TSAC

Zigzag Validity
by Spyros Raftopoulos

Aug.2002 TASC

Info collected on zig zag from 10-05-2021 onwards:


(DETECTING HIGH VOLUME BREAKOUT)

ZIGZAG INDICATOR SECRET

shows changes in trends that occur in price movements.

look for price reversal points or reversals. At a point that is considered a reversal point, it will be
connected by changes in zig-zag lines.

zigzag is very sensitive to any price movements, so you need to be careful when using this
indicator.

you are not recommended to use zigzag as a single indicator. You need to add some other
indicators, but the zigzag indicator is used only as a tool in finding waves in the Elliot wave
system.

This indicator is needed to determine trend movements while indicating maximum prices and
minimal prices.

The indicator at a glance displays the perfect trend reversal point, but it's not that easy to
understand.

Although you can use this indicator alone, it is not wise because it is a repaint indicator.
This means that it will change its direction according to the last price.
But indicators are a good toolbox if a trader already has good skills in using this indicator well.

WHAT IS ZIGZAG INDICATOR?


The zigzag is used to find swing highs and swing lows on a timeframe.

This indicator can be used for various trading styles, scalping or intraday as well as swing
trading strategies.

Its appearance is straightforward, it is just a line connecting swing high and swing low on a
timeframe.

However, to use the Zigzag effectively one has to follow the required parameters.

 Depth - the indicator may repaint, so you should refer to how far the support and resistance
zones are to the newly formed Zigzag pattern.

 Deviation - you also need to pay attention to the deviation of the indicator on the trend line
from positive to negative.

You can make indicator settings to find symmetrical parameters with the ABCD pattern as a
basic pattern in the harmonic pattern. By default setting, Depth = 12, deviation = 5, backstep
= 3.

In its application in trading, Zigzag can be applied alone or in combination with other
toolboxes.

In general, a combination with an Elliot pattern, or a harmonic pattern, this indicator signals
a trend reversal when the leg changes direction.

HOW TO TRADE WITH ZIGZAG?


How to use zigzags is very diverse, but I will give you how to use the zigzag indicator with other
toolboxes, Fibonacci extensions, MACD, Moving average, and Bollinger bands.

ZIGZAG INDICATOR AND FIBONACCI EXTENSIONS


Concerning the zigzag trading strategy with Fibonacci, this is to find harmonic patterns and can determine
to stop loss based on risk levels using Fibonacci.
 The first step is to attach a zigzag indicator with the setting Depth = 20 and Deviation = 5. This is to find
more significant swing highs and swing lows.

 The second step is to draw the Fibonacci extension by taking from the three-point swing high and swing
low of the Zigzag indicator.

 Step three we are waiting for three waves at 0.618 - 0.786 or between 1.0 - 1.272, this is to find the basic
ABCD harmonic pattern. This pattern does not appear often, so it takes a lot of patience to find a valid
pattern.

 For ABCD symmetric pattern, you must follow the rules of the required requirements. If this pattern has
been found, step four is to wait for the candle to form a higher low for a Buy setup and a lower low for a
Sell setup.

 For stop losses, you can place below the lower low of a reversal candlestick for a Buy setup and at the
higher high of a reversal candlestick for a Sell setup.

 For taking profit preferably with a ratio of at least 1: 1 from your stop loss.

Zig-zag indicator combination with MACD

To display this Zig-zag indicator by calling it by clicking on the indicator list on the MetaTrader 4 used and
then selecting the custom indicator, there will be a Zig Zag indicator at the bottom of the list of indicators.

Determine the number 62. That is the percent change in price from the minimum or maximum number
shown by this indicator with the intention that if the zigzag describes a straight line on the chart and
shows a minimum number then the next straight line that shows the maximum number will appear after
the price moves 62% more.

There is a negative side to this indicator. If the price does not pass this percent parameter and flips and
moves next in the same direction, the zigzag image will change too. Therefore, the indicator should be
determined manually.

So, when the required percent limit is determined, the trader can see the results. The indicator describes
only the maximum and minimum numbers that exceed the number of percents that has been determined

Next, let's take another indicator as a zig-zag help tool, which is MACD, and underline when the most
important is the entry point.
Take a look at the image above, when the signals of the two indicators are connected, we can conclude
that if zig-zag has worked on the minimum number Signal MACD can be prepared. But the possibility is
that it repaint and then MACD which is held by the zigzag is also there, so it is necessary to do it to find
the signal divergence.

So, for maximum results, you should look for buy signals from the tool. In this situation, zigzag and MACD
are two indicators that help in charting the market.

But there is a second possibility to use this indicator. This possibility is according to the Elliot wave
principle. The zig-zag indicator works on impulse and correction waves. The impulse wave includes five
small waves and towards the bigger and stronger tendency, while the correction wave includes three
small waves and moves towards the tendency.

Zigzag indicators with moving average


In forex trading, you can combine zigzag indicators with moving average indicators to get profit in trading.
It is recommended that you use the MetaTrader to display the indicator.

The following is a setup guide for the zig-zag & moving average indicator.

ig Zag shows past performance trends and only the most important changes. This indicator filters all
changes less than a certain number. Zig Zag can help you see changes by highlighting the most important
reversals. In the last segment in Zig Zag, it can change based on basic plot changes.

Without moving averages or other trend indicators, don't try to trade only with zig-zag.

Repeat the process, to get the moving average period 4, distinguish the color from the moving average
2.Again, repeat the process to display 30 moving average indicators.

How to use for the two indicators are as follows:

 If Zig Zag has connected the price from top to bottom or vice versa then there is a trend change if the
average moving 2 has crossed/passed the moving average 4. If the moving average 2 is a 4 cross moving
average from the bottom up, and there are zig-zag connections, then you can do open Buy.

 Conversely, if the average moving 2 is already cross moving average 4 from top to bottom then you can
open sell, especially if the zig- zag has made a connection.
If the moving average 2 is already cross moving average 4 and in a few days later it has crossed the
moving average of 30 then there will be a trend of a significant increase or decrease in price. The target in
1 day using this indicator is 20-100 points.
Using double zig-zag with Bollinger bands

Zigzag settings 1:
 Depth: 24

 Deviation: 5

 Backstep: 3

 Colors: Gold

Zig-Zag 2 Settings:
 Depth: 12

 Deviation: 5

 Backstep: 3

 Colors: Red

Put Bollinger Bands Inator

To install the Bollinger Bands indicator, you can directly from the MetaTrader application, by clicking
Insert, select indicators, Trend, then select Bollinger Bands.
Bollinger Bands Settings:
 Period: 20

 Deviation: 2

 Shift: 0

 Apply to: Close

 Style: SeaGreen Medium

HOW TO ENTRY:
Pay attention to the meeting point between the red zigzag and zigzag gold, when it is located at the bottom
of the ribbon and the upper ribbon. If the zigzag and zigzag gold meetings are supported, be prepared to
do a Buy position and if the red zigzag and zigzag gold are in the resistance point, be prepared to take a
Sell position. The good Time Frame used for Entry is Timeframe H1.
Double Zigzag and Bollinger bands are a combination of easy-to-understand and many successful
indicators used in Forex trading.

ZIGZAG INDICATOR NO REPAINT MT4

The zigzag indicator is essentially a repaint, meaning that it will reposition the endpoint to adjust to the
current market price.

If you look at the indicator line history, maybe you will think that the indicator is very accurate. But when
you use it live, then you realize that the indicator repaints. Of course, the signals that have appeared are
invalid and give false signals.

The No repainting indicator relies on previous data to generate its signal. Once the indicator signal
appears, it will not change following the last price change. In this way, they provide a more definite signal
that doesn't change although the situation changes.

And it turns out that there is also a zigzag which is designed as a no repaint indicator, the indicator is a
fractalzigzag. Below image Fractalzigzag combines with zigzag default indicator:

The Fractalzigzag indicator is a truly no repaint indicator, which is an arrow pointing down and arrow
pointing up depending on the buy or sell signal given.

The blue arrow indicates that the trend will go up, and the red arrow gives an indication that the trend will
move down.

Indicators can be applied to all timeframes so they can be used for all trading styles.

Zigzag indicator no repaint mt4 free download

 ZZDepth - by default uses 12 periods, you can set as needed, in long term trading usually uses a higher
period than short term trading

 ZZDev- By default, the value is 5, there is no big deviation even when changing the value, it is better to use
the value 5 for ZZdev.

How to trade with Fractalzigzag no repaint indicator


The way to trade with this indicator is very simple, buy order when a Blue arrow appears and is followed
by a bullish candlestick close.

Meanwhile, the Sell order when the Red arrow appears is followed by a bearish candlestick close.
How about stop loss and profit-taking are to take a distance of buy and sell positions depending on your
risk management plan. When the arrow changes from your position you should close your position.

Advantage
The advantage of using this indicator is that it is easy to use even a newbie, traders are just waiting for the
blue or red arrow to appear as a confirmation signal.

Disadvantage
This indicator is indeed a no repaint, even though the price changes the indicator remains unchanged, but
the drawback is, the possibility of a false signal that appears can drag you into prolonged floating loss if
you don't use a stop loss.

So it's better if you use this indicator in combination with other indicators as a filter, for example with
support and resistance.

CONCLUSION
it can help you perform analysis to find swing highs and swing lows on a timeframe.

This indicator can also be the basis for finding the Elliott wave pattern manually. For this, using Fibonacci
coalescence can be a way of measuring the Elliot wave rule.

However, in using this indicator is to emphasize risk management, you need to have a second scenario
when you often get false signals.

The best way is to stop loss and determine a reward ratio of at least 1: 1, for once losing trades will be
covered by one winning trades.

It also depends on your policy, some traders give a loss ratio greater than the target, because it gives the
price movement room to reach the target.

W pattern in break out (IMP)

A significant market lows, zigzags sometimes develop with a double or triple


W, much like a coiling spring, prior to the actual breakout The range from
top to bottom tends to be relatively small, and it is tempting to think that
nothing significant is happening. However, the market shows its hand
remarkably often when there is a pattern of higher highs and higher lows
within a small range. The more developed the pattern is prior to the breakout,
with more than just a couple of tops and bottoms, the more likely it is that
price will follow through when the breakout occurs.
Equally important is that the line chart can suggest which way price is likely
to move out of consolidation within an apparent longer-term move. Some
technicians hold that the probabilities are more favorable for a successful
trade if you wait for the breakout from a range before entering a new
position. Certainly, this is true when the price fluctuations within a
consolidation are erratic, because then the breakout may be in either
direction. However, orderly coiling on the line chart is a reliable predictive
indicator, when it happens, and there can be a surging breakout like the
action when you release a spring that has been compressed.
Often, therefore, the best way to trade coiling action within a
consolidation may be to enter an initial trade—say, half your normal
commitment—as favorable coiling is developing and then to add to the
position when the breakout occurs
How to Use Zigzags

1. To define a trend on a chart of any duration, you need at least an initial M


or W and, ideally, an established and regular zigzag

2. For trading decisions, the weekly chart normally defines the major trend,
although the daily chart alone may sometimes justify taking a trade.
For those markets having very long-term trends, look at the monthly chart
for additional confirmation, but don’t be deterred from trading if the
monthly chart has not yet fallen into line. Monthly charts are most useful
for markets that have long-lasting moves, such as the financials, metals, and
stock indexes. Agricultural markets tend to have shorter cycles, with trends
determined by the prospects from one harvest to the next or by stock
breeding cycles.
3. Occasionally, such as when a market has reached a clear and substantial
barrier or when there is an island top or bottom, you might want to use an
intraday chart, such as the 60-minute or the 120-minute, to use zigzags to
make
a preemptive assumption of a trend reversal. This application is most
valuable for those using day-trading techniques for potentially optimal new
entries or to ride a rebound from an obvious excess, as discussed in Chapters
22 and 23.

4. The signal for action occurs on completion of the time period generating
a turn A conflicting M or W or an established zigzag on the line chart—one
in the opposite direction to the way you want to trade—is a strong negative
indicator when it is clear and completed, but it does not constitute an outright
embargo. Normality is for there to be wobbles and conflicts. You might, for
example, consider a trade when there is a good zigzag on the weekly chart
and on the 60-minute chart but not on the daily chart.

5. Market action negates a zigzag in a bull market with a closing price below
the previous low on the line chart or in a bear market with closing above
a previous high. When this happens, there is a strong exit signal from this
indicator, but not necessarily a compulsory one, on the duration of the chart
on which it occurs. An adverse close is exponentially more important on the
daily chart than it is on the 60-minute chart and more so again on the weekly
chart than on the daily chart.
6. A negated trend on the line chart does not connote a signal to trade in
the opposite direction. That requires completion of an equal and opposite
M or W.
7. Look for coiling action within consolidations—particularly when a market
is overbought—to sell or—oversold—to buy. A tight range in price does not
mean that there is limited potential as and when the price breaks out of the
range—on the contrary! Well-defined coiling action often permits a timely
entry at an excellent price relative to the risk.
8. In a strongly moving market, thrusts in the direction of the trend
should take price a long way, and retracements should give back little in
price and last only for a few bars.
9. M’s and W’s and established zigzags also apply to other indicators
such as moving average convergence/divergence (MACD)and
stochastics, as discussed in later chapters.

At the most trustworthy market turns, price and momentum indicators such
as stochastics both make simultaneous M’s and W’s and then zigzags, in the
same direction. When stochastics, a leading indicator, makes a higher second
low and a corresponding W, but the price makes a lower low, there is a so-
called negative divergence. Similarly, there is a negative divergence when
stochastics make a second lower high but price does not. At the very least,
negative divergence shows flagging momentum and the potential for price to
reverse direction. Action in stochastics is more reliable than price action.

Stay in current position (long or short) till reversal pattern (in opposite
direction) is confirmed.
Technical analysts advise the traders to stay in a trade until the line of the zig zag
indicator confirms in the opposite direction. For example, if the investors are looking
to enter a long position, they should wait and avoid selling until the Zig Zag line
confirms by turning downward. They also suggest using large timeframes to make the
highest profits. Otherwise, the probability of losing trade will be quite high. This is all
that makes the zig zag very versatile and only one of its kind.
ZIG ZAG repaint :
Quite often, newcomers tend to be totally amazed by it, believing that with it, they cannot go
wrong. In reality however, nothing could be further from the truth, mainly because it does
something called "repainting". In other words, during a live progression of price action
changes, the indicator changes the most recent Top or Bottom in order to reflect the new
price data. By the time the ZigZag Top or Bottom has settled in and establish itself on the
indicator, the current situation of the market has long changed and is no longer congruent
with the point that was initially indicated as being a Top or a Bottom of the prices.
NASDAQ WEBSITE
Talking Points
-Zigzags appear in the construction of many of the Elliott Wave patterns
-Zigzags subdivide as an A-B-C (5-3-5) sequence
-Many times, wave C can be estimated using common rations and channeling
In Elliott Wave theory, a zig zag is a pattern consisting of 3 waves labeled A-B-C. Most of the
time, the pattern will print in the direction against the main trend and is typically a counter
trend formation. Z ig zags are typically found in the 2 nd wave of a 5 wave impulse and have
a part in the formation of Elliott wave triangles . Many times, zig zags appear somewhere
within a complex correction. There are even a few instances where a zig zag will print in the
direction of the larger trend . As a result, the zig zag pattern is an integral price pattern which
can be found in several locations within the eight wave Elliott Wave sequence.
Zigz ags can print in either the bullish or bearish direction.
Idealized Bullish Zigzag

[Image 1]
Zig zags look like a lightning bolt on the chart. There are 2 rules for zig zags:

1. The sub waves of an A-B-C zig zag appear as 5-3-5


2. Wave B of the zig zag cannot retrace 100% of Wave A - most of the time wave B
retraces 38-78% of wave A
The 3 waves of the zig zag (A-B-C) subdivide as a 5-3-5 meaning the 'A' leg has 5 sub waves
in it, the 'B' leg has 3 sub waves in it, and the 'C' leg has 5 sub waves in it. As a result of the
'A' and 'C' legs both containing 5 sub waves each, the impact of the whole zig zag structure is
to be a deep retracement and recover a lot of price from the previous trend.
Also, the zig zag was designed to make progress against the tre nd. Therefore, wave B of a
zig zag can be any 3 wave pattern (including another zig zag), but wave B cannot retrace
100% of wave A. A retracement of 99% is acceptable, though unlikely and progress needs to
be made.
There are a couple of reasons why the 2 nd wave of a 5 wave impuls e is typically made up
of a zig zag. The first reason is because the 1 st wave is the start of a new trend, the 2 nd
wave can be latent desires for the old trend to continue. As a result, the 2 nd wave acts as a
shake out for the new trend traders and the old trend traders as a deep retracement is
typically obtained. Second waves typically retrace 50-78.6% of the first wave.
Within the zig zag pattern, many times you can estimate the termination zone of wave C. In
Elliott Wave Theory, alternating waves tend to be related in distance . Therefore, once we
believe wave C has started, we can estimate the length of C based on the length of A. Wave
C typically has an equal measurement to wave A, or a .618 or 1.618 multiple of wave A .
In the example below, we can see where wave 'C' was equal in length to wave 'A' at the
purple line labeled "1.000 0.74867."
Additionally, it is common for the A-B-C zigzag to create a price channel. So we can use the
price channel as a means to estimate the ter mination point of C and the zig zag pattern.
These price approximations become powerful when there are other wave relationships
showing up in the same price zone as the estimated termination point.
---Written by Jeremy Wagner, DailyFX Education

 The Zig Zag indicator works best in strongly trending markets.


Note: Traders should be aware the most recent Zig Zag line may not be
permanent. When price changes direction, the indicator starts to draw a new line. If
that line does not reach the indicator’s percentage setting and the price of
the security reverses direction, the line is removed and replaced by an extended Zig
Zag line in the trend’s original direction.

Introduction
Every trader surely knows the ZigZag indicator intended for the analysis of price movements of given or
greater amplitude. A ZigZag line is a broken line whose nodes are located at highs and lows of the price
chart.

There are many variations of this indicator: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16.
Yet, a lot of MQL5 program developers are keen on creating their own 'ideal' ZigZag. The main
downsides of the ZigZag indicator are delays, incorrect markings of questionable nodes (external
bar) and unsatisfactory performance.
In my opinion, the most elegant ZigZag implementation was proposed by Yuri Kulikov (Yurich).
Besides, there are some very good MQL4 articles, such as "Layman's Notes: ZigZag..." and "Show
Must Go On, or Once Again about ZigZag". The subject seems to have been substantially explored,
with a great number of publications being available. Yet there is something magnetizing about it.
Now, it has also caught my interest, particularly in the possibility of creating an advanced ZigZag
indicator.

This article describes a method for creating an advanced ZigZag using the Envelopes indicator. It is
assumed that we can find a certain combination of input parameters for a series of Envelopes,
whereby most ZigZag nodes lie within the confines of the Envelopes bands.

A Method for Creating an Advanced ZigZag Indicator


We will set an objective: to find coordinates of two nodes - the current and the predicted node
(Fig. 1). The current node is a node that is not yet completed whose coordinates are still being
searched for or adjusted. Moreover, it is always on the current (zero) bar. While being in the
future, a predicted node must show the estimated level of the next ZigZag node.

So the objective is set and we have an idea of how to use Moving Average Envelopes as a basis for
building an advanced indicator (Fig. 2). We will search for envelopes whose deviation from ZigZag nodes
is minimal. It appears quite logical that envelopes for ZigZag peaks and troughs must be searched
separately.
To increase the statistical significance of the forecast, instead of using only one or
even 10 Envelopes indicators, we should use a pool of 100 or more indicators with
different input data. They will differ in averaging period of the main indicator line
and the price used (High for peaks and Low for troughs). Let's introduce the
following notations and formulas:

 ZZ - the ZigZag indicator;


 ENV - the main line of the Envelopes indicator (coincides with
the iMA indicator);
 Envelopes(i) - value of the main line of the Envelopes indicator on the i'th bar;
 ZZ(High) - ZigZag peak value;
 ZZ(Low) - ZigZag trough value;
 ENV(High) - value of the main line of the Envelopes indicator corresponding to
a ZigZag peak;
 ENV(Low) - value of the main line of the Envelopes indicator corresponding to
a ZigZag trough;
 n_high - number of ZigZag peaks;
 n_low - number of ZigZag troughs.

We have two indicator pools: one for peaks and the other one for troughs (around
100 indicators in each one). We will calculate the deviation of ZigZag nodes from
the main line of the Envelopes indicator for each indicator in the pool and find the
arithmetic mean of deviations for each pool indicator using the above formulas. The
following figure demonstrates a diagram of deviations with respect to the identified
nodes ZZ from the main line ENV for one indicator.
The arithmetic mean of the deviations will be used for determining the level to which the main
line of the Envelopes indicator should be moved to plot the envelope bands. So, we will need the
arithmetic mean of deviations from ZigZag peaks to draw the upper line and the arithmetic mean
of deviations from troughs to draw the lower line of the Envelopes indicator.

It is upper and lower lines of envelopes that we are going to use to find characteristic points and
predict ZigZag nodes. Once again, we are interested in the pool of envelopes consisting of a set of
the Envelopes indicators. The arithmetic mean of deviations of ZigZag nodes from the main line of
a given envelope is calculated for each indicator. After plotting the resulting lines (the upper and
lower line) of the pool in the chart, we will be able to see the following:
If we assume that each line lies on a separate plane, while all of them together create a surface, the above
figure only shows the projection of each indicator on the price chart plane. A 3D image of these lines will
be roughly as follows:
Let's now have a quick lesson in geometry. Imagine that the pool of lines of the Envelopes
indicator is a 3D surface. Take a plane perpendicular to the price chart and cut the surface at the
current (zero) bar.

As a result, we get a cross-section of the surface representing a curve (the above figures
demonstrate a special case where the curve is a straight line). To do the forecast, it is sufficient
to have the coordinates of each point on the curve that will further be used in calculations.

We will need the following cross-section characteristics: maximum and minimum point, as well as
the center of gravity of the cross-section (the arithmetic mean of all point values). The obtained
characteristic points will be projected on the current (zero) bar, with the relevant data being
stored in the history. These characteristic points will serve as the basis for the current and the
next ZigZag nodes.

Since the search for Envelope bands is performed separately for peaks and troughs, as a result we
should get two cross-sections: one for peaks and the other one for troughs

To get the forecast, we will use the nearest characteristic point. For example, when searching for
a ZigZag peak, we take the characteristic points of the cross-section resulting from the
intersection of the surface of the upper lines of the Envelopes indicator with a cutting plane.
Conversely, to find a trough we take the characteristic points of the cross-section resulting from
the intersection of the surface of the lower lines of the Envelopes indicator with a cutting plane.

Testing New Indicator


Now that we have defined the method, let's create the indicator. We will first find the last nodes
of the ZigZag indicator and draw them in the chart. For this purpose, we will use
the AdvancedZigZag class written for the task at hand:

There are two methods in total:

 The Count method finds all ZigZag nodes over a given time period (number of bars) and
saves them in various arrays, separating peaks from troughs. This way it will be easier to do
the analysis and calculation of the envelopes;
 The Read method finds the last nodes and saves them in a single array. We need this
method for the ZigZag indicator visualization;

TheGetExtremums library (by Yury Kulikov) will also be necessary in searching for nodes.

Let's put the indicator under consideration in an Expert Advisor. Why an Expert Advisor and not an
indicator? This is of course a matter of taste but it appears to be more efficient to me that way.
Expert Advisor's graphical features are undoubtedly weaker but we gain in performance since
same-symbol indicators operate in a single stream, while every EA operates in its own separate
stream. Let's take a look at the code:

We need to clarify a few things here:

 The iEnvelopes indicator is replaced by the iMA indicator. There is nothing false or
misleading in it. The thing is that the main line of iEnvelopes coincides with iMA! It is
therefore more convenient to use the Moving Average indicator.
 We use two pools of moving averages, consisting of 227 lines each, thus making
454 iMA indicators in total! Is it much or little? Basically, it is a big number. But, first of all,
we can change the number of indicators, if necessary, and secondly, we need statistics.
What is the point in searching envelopes for a dozen nodes? We need at least a hundred.
 Indicator values are loaded in the OnTick() block instead of OnInit(). If the data loading
block is placed in OnInit(), it is very likely that some data may be late to load and the
indicators will as a result not be calculated accurately and in full. After all the data for the
calculations is obtained, the err variable value will get positive and this block will be
excluded from operation.

So, the resulting indicator plots the last seven ZigZag nodes and calculates the coordinates of all
other nodes over a given history (Fig. 6). The calculation is only performed once and we further
use the calculated data. You can of course implement it in such a way so as to allow the data to be
updated regularly but in this article we will keep it to a single pass.

Further, let's plot the cross-sections of the surfaces of the Envelopes indicators. To do this, we will add the
following to the OnTick() method:
A note for novice programmers: operators at the end of the Peaks and the Troughs block do not have ';' at the
end of the string. It is not a mistake or a typo. Those are macros (see the data section where they are declared)
- they are very useful! I recommend that you use them in your programs.

To discern the cross-section points of the surface formed by the envelopes lines, the points vary in size:
the greater the averaging period of the main line of the Envelopes indicators, the larger the points (Fig. 7).
Moreover, the cross-sections are rotated around a vertical axis passing through the current (zero) bar in
different directions: peaks are at 90 degrees to the right and troughs are at 90 degrees to the left.
Now they can be seen in the price chart plane. Initially, they were lying in the cutting plane (Fig. 5) and
could not be observed. We could only picture them to ourselves, without having any idea about their
shape. The cross-section lines have turned out to be of a very peculiar shape. This is also done for the
convenience of graphic analysis. Visually the cross-sections resemble two flying comets:

When using the ZigZag feature, don’t forget to measure the last line to determine if it is
temporary or permanent.

The last ZigZag line is temporary if the current price change is less than the ZigZag
parameter.

The last line is permanent when the price change is greater than or equal to the ZigZag
parameter.
Let's proceed to the calculation of the cross-section characteristics: the maximum and the
minimum, as well the center of gravity (the arithmetic mean). The resulting values will be
displayed as points on the current bar, with the point size corresponding to the size of the
relevant characteristic. In addition, we will save them in the history for further analysis. So, we
will add the following to the existing code:

Now let's see what it looks like when represented graphically:

We just need to add the last finishing touch by finding and plotting advanced ZigZag nodes. We
enhance the code by adding the following:
So, we have got the new advanced ZigZag indicator that predicts the position of new nodes (Fig.
9). The nodes themselves are located in the characteristic cross-section points: the maximum, the
minimum and the center of gravity. The working title of the indicator is "Two Comets".
It should be noted that the completion time of the next node, which is in the future, has remained
unknown. Basically, we can only predict one node coordinate - the price.
Analysis of the Results and Recommendations for Developers
The indicator observations have shown that:

1. Deviations of the ZigZag node coordinates from the predicted nodes are within the
tolerance region. The vast number of nodes lies in the shadow of the corresponding cross-
section. This is certainly just a qualitative assessment. More accurate results will follow in
the future articles.
2. Cross-sections of the envelopes lines demonstrate the market behavior and expected price
momentum! Pay attention to the comet tail that is made up of points with the smallest
averaging period (the smallest in size). It is directed in the direction of the price. The
comet's tail bends in the most intricate ways and the more it is turned in the opposite
direction, the bigger the chance to see the trend change. Simply watch the behavior of the
indicator on different time frames with different amplitudes. This is extremely interesting!
3. The characteristic points of cross-sections form lines that may exhibit strong resistance to
the price movement. Therefore they can be considered as support and resistance lines.
4. When the points of the center of gravity of the cross-section get ahead of it (as the peaks in
Fig. 9), this is an indication of the presence of the upward trend.

So what we got as a result is a very interesting indicator that can be tried out in a trading strategy!

 The method for predicting ZigZag indicator nodes reviewed in the article allowed us to create the
new indicator - "Two Comets".
 The advanced ZigZag shows possible coordinates of new nodes, even though this is only a forecast.
 The algorithm considered in the article can be used to plot similar advanced indicators, not
necessarily being ZigZag indicators, e.g. fractals or semaphore indicators.
IMP POINTS:

1.ZigZag Indicator tracks and connects extreme points of the chart, the distance
between these points being equal or higher than the percentage specified for the
price scale.
2.Depth is the minimal amount of bars where there will not be the second maximum
(minimum) Deviation pips higher or lower than the previous one. I.e., ZigZag can
always diverge, but it can converge (or completely draw together) more than at the
Deviation value only after Depth bars. Backstep is the minimal amount of bars
between maximums/minimums.
3.After the ZigZag has captured the lowest point, it starts to search for the turn
point until the rollback down from the maximum value exceeds the parameter. As
soon as rollover down exceeds the parameter, the second (in this case, the upper)
point is considered for captured, and ZigZag starts to search for the third one (in
this case, for the lower one), etc.
4. settings of 5,5,3 are far more useful than settings of 12,5,3

-------------------------------------------------------------------------------------------------------------

You might also like