ZigZag Channel Indicator

Do you like the ZigZag indicator? I like it so much because it's the easiest way I can use to draw the trends.
As you see in Figure 1 the trends are drawn for the last two highs and the last two lows of the ZigZag indicator (The ZigZag indicator is in Red and the two bands are in Red and Blue).

zigzag channel indicator

How to use MetaTrader to draw the trends (The hard way)?

To use ZigZag first you have to go to the navigator window and choose it from the custom indicator (figure 2).
Now to draw the upper trend line you have to choose the trend line from the lines toolbar (figure 3) then draw a line connecting the most near two highs of the ZigZag indicator.
For the lower trend line you will do the same steps but in this case you will draw a line connecting the most near two lows of the ZigZag indicator.



Traders voice:

I don't talk about trading a lot (because I'm a good coder not trader) but the traders use the breakout of the upper and lower trend lines to sell and buy:
When the price break up the upper trend line it's a long signal.
When the price break down the lower trend line it's a short signal (figure 4).
The upper and lower trends used as resistance and support lines.


How to draw the trends using MQL4 (The easy way)?

I modified the ZigZag indicator to automatically draws the upper and lower trends lines for you. Just drop it on the chart and it will do all the job.

These are the settings you can play with:

ExtDepth, ExtDeviation and ExtBacksep:
These are he normal parameters of the ZigZag indicator, set them to the values you used to use or keep the defaults.

The number of pips below/above the trend to show the alert.

The color of the upper trend line.

The color of the lower trend line.

If you want to draw the trend for previous highs and lows (in the case you want to test the system of trend break out for previous periods or for any other reasons) you can set the back to the number of the highs and lows back in history to draw the upper and lower trend lines.
For example in figure 5 "back" was set to 1.

Set the alert on/off.


I hope you enjoyed the ZigZag Channel indicator, and I hope you give the code a look and ask me if you find anything not understood.

Coders' Guru

Last Update: 2011.09.20