Do you like the ZigZag indicator? I like it too
much because it's the easiest way I can use to
draw the trends.
As you see in Figure 1 the trends are drawn from
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 Yellow).
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 in trading too much (because I'm
a good coder not trader) but the traders use the
breakout of the upper and lower trends line 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.
color_trend_1:
The color of the upper trend line.
color_trend_2:
The color of the lower trend line.
back:
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.

I hope you enjoyed the ZigZag Channels
version and I hope you give the code a look and
ask me if you find anything not understood.
Cya!
Coders' Guru
Download
|