Description
The ZigZag indicator highlights trends based on user defined threshold values. You can access methods within this indicator to determine the number of bars ago a zigzag high or low point occured or the current zigzag value.
Syntax - Bars Ago
ZigZag(DeviationType deviationType, double deviationValue, bool useHighLow).HighBar(int barsAgo, int instance, int lookBackPeriod)
ZigZag(IDataSeries input, DeviationType deviationType, double deviationValue, bool useHighLow).HighBar(int barsAgo, int instance, int lookBackPeriod)
ZigZag(DeviationType deviationType, double deviationValue, bool useHighLow).LowBar(int barsAgo, int instance, int lookBackPeriod)
ZigZag(IDataSeries input, DeviationType deviationType, double deviationValue, bool useHighLow).LowBar(int barsAgo, int instance, int lookBackPeriod)
|
Return Value
An int value representing the number of bars ago. Returns a value of -1 if a swing point is not found within the look back period.
Syntax - Value
Return Value
double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.
* A return value of 0 (zero) indicates that a zigzag high or low has not yet formed.
Parameters
barsAgo
|
The number of bars ago that serves as the starting bar and works backwards
|
deviationType
|
Possible values are:
DeviationType.Points
DeviationType.Percent
|
deviationValue
|
The deviation value
|
input
|
Indicator source data (?)
|
instance
|
The occurrence to check for (1 is the most recent, 2 is the 2nd most recent etc...)
|
lookBackPeriod
|
Number of bars to look back to check for the test condition. Test is evaluated on the current bar and the bars in the look back period.
|
Examples
Print("The high of the zigzag bar is " + High[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100)]));
|
Source Code
You can view this indicator method source code by selecting the menu within the NinjaTrader Control Center window.
|