+1 888 340 6572 
Home/ Support/ Knowledgebase

Knowledgebase

The Knowledgebase and Wiki are a collection of helpful resources for MultiCharts Trading Platform customers.

You can search the base by section, by keyword(s) or both. Select a section from the pulldown menu at the left and enter a keyword or keywords separated by spaces and click "Search". You can also select a section and view every article in it. To do this leave the keyword field blank. The results of your search will be displayed in this frame.
Search in     for   




SwingCharts > ZigZag [eSignal EFS Indicators]


Download: ZigZag.efs

Category: Indicator > SwingCharts

Description:

The ZigZag Percent indicator finds Swing Highs and Swing Lows that are distant by at least the percent specified by the input WavePcnt. A Swing High is a high higher than the highs before and after it; a swing low is a low lower than the lows before and after it. The color and weight of the lines drawn with this indicator may be adjusted by editing the inputs Color and Thicknes.

The Zig Zag indicator is used primarily to help you see changes by punctuating the most significant reversals.

It is very important to understand that the last "leg" displayed in a Zig Zag chart can change based on changes in the underlying plot (e.g., prices). This is the only indicator in this book where a change in the security's price can change a previous value of the indicator.

Since the Zig Zag indicator can adjust its values based on subsequent changes in the underlying plot, it has perfect hindsight into what prices have done. Please don't try to create a trading system based on the Zig Zag indicator--its hindsight is much better than its foresight!

Inputs:

WavePcnt - Minimum percentage difference between swing highs and swing lows to plot
nColor - Color of the lines drawn on the chart by this indicator
Thicknes - Thickness of the lines drawn on the chart by this indicator
SwingHigh - Specifies which price of the asset of interest is to be used
SwingLow - Specifies which price of the asset of interest is to be used




EFS Code:

/*******************************************************************
Description : This Indicator plots ZigZag indicator
Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
********************************************************************/

function preMain()
{
setPriceStudy(true);
setStudyTitle("ZigZag");

}
var First = true;
var RP = null;
var RPPoint = null;
var RP1 = null;
var RPPoint1 = null;
var Switch = 0;
var Condition1 = false;
var Condition2 = false;
var s = "X";

function main(WavePcnt, SwingHigh, SwingLow, Thickness, nColor)
{
if (WavePcnt == null) WavePcnt = 5;
if (SwingHigh == null) SwingHigh = "High";
if (SwingLow == null) SwingLow = "Low";
if (Thickness == null) Thickness = 1;
if (nColor == null) nColor = Color.red;
if (nColor == "red") nColor = Color.red;
if (nColor == "black") nColor = Color.black;
if (nColor == "blue") nColor = Color.blue;
if (nColor == "cyan") nColor = Color.cyan;
if (nColor == "green") nColor = Color.green;
if (nColor == "magenta") nColor = Color.magenta;
if (nColor == "white") nColor = Color.white;
if (nColor == "yellow") nColor = Color.yellow;
if (nColor == "purple") nColor = Color.purple;
if (First)
{
First = false;
RP = (high(0) + low(0)) / 2;
RPPoint = getCurrentBarIndex();
RP1 = RP;
RPPoint1 = RPPoint;
}
var SH = 0.0;
var SL = 0.0;
//SwingHigh
var Occur = 1;
var Strength = 1;
var Length = 2;
var Price = SwingHigh;
var vPrice = getValue(Price, 0, -(Strength + Length + Occur + 1));
var Price1 = 0.0;
var J = Strength;
var Found = false;
var Counter = 0;
var X = 0;
var XX = 0;
var YY = 0;
var Truth = true;
for (J = Strength; (J < Length)&&(Found == false); J++)
{
Price1 = vPrice[J];
X = J + 1;
Truth = true;
for (X = (J + 1); ((X - J) <= Strength)&&(Truth); X++)
{
if (Price1 < vPrice[X]) Truth = false;
}
X = J - 1;
for (X = (J - 1); ((J - X) <= Strength)&&(Truth); X--)
{
if (Price1 <= vPrice[X]) Truth = false;
}
if (Truth) Counter++;
if (Counter >= Occur) Found = true;
}
if (Found) SH = Price1;
else SH = -1;
//SwingLow
Price = SwingLow;
vPrice = getValue(Price, 0, -(Strength + Length + Occur + 1));
J = Strength;
Found = false;
Counter = 0;
for (J = Strength; (J < Length)&&(Found == false);J++)
{
Price1 = vPrice[J];
X = J + 1;
Truth = true;
for (X = (J + 1); ((X - J) <= Strength)&&(Truth); X++)
{
if (Price1 > vPrice[X]) Truth = false;
}
X = J - 1;
for (X = (J - 1); ((J - X) <= Strength)&&(Truth); X--)
{
if (Price1 >= vPrice[X]) Truth = false;
}
if (Truth) Counter++;
if (Counter >= Occur) Found = true;
}
if (Found) SL = Price1;
else SL = -1;
//ZigZag
if (SH != -1)
{
if ((Switch != 1)&&(SH >= (RP * (1+(WavePcnt*.01)))))
{
s += "X";
RPPoint1 = RPPoint;
RP1 = RP;
RPPoint = getCurrentBarIndex() - 1;
RP = SH;
drawLineAbsolute(RPPoint,RP,RPPoint1,RP1, PS_SOLID, Thickness, nColor, s);
Switch = 1;
}
else
if ((Switch == 1)&&(SH >= RP))
{
RPPoint = getCurrentBarIndex() - 1;
RP = SH;
drawLineAbsolute(RPPoint,RP,RPPoint1,RP1, PS_SOLID, Thickness, nColor, s);
}
}
if (SL != -1)
{
if ((Switch != -1)&&(SL <= (RP - (RP*(WavePcnt*.01)))))
{
s += "X";
RPPoint1 = RPPoint;
RP1 = RP;
RPPoint = getCurrentBarIndex() - 1;
RP = SL;
drawLineAbsolute(RPPoint,RP,RPPoint1,RP1, PS_SOLID, Thickness, nColor, s);
Switch = -1;
}
else
if ((Switch == -1)&&(SL <= RP))
{
RPPoint = getCurrentBarIndex() - 1;
RP = SL;
drawLineAbsolute(RPPoint,RP,RPPoint1,RP1, PS_SOLID, Thickness, nColor, s);
}
}
return;
}
Contact Support
Discussion Forum
Project Management
Online Help & Wiki
Video Tutorials
Blog