Lean  $LEAN_TAG$
QuantConnect.Indicators.ZigZag Class Reference

The ZigZag indicator identifies significant turning points in price movements, filtering out noise using a sensitivity threshold and a minimum trend length. It alternates between high and low pivots to determine market trends. More...

Inheritance diagram for QuantConnect.Indicators.ZigZag:
[legend]

Public Member Functions

 ZigZag (string name, decimal sensitivity=0.05m, int minTrendLength=1)
 Initializes a new instance of the ZigZag class with the specified parameters. More...
 
 ZigZag (decimal sensitivity=0.05m, int minTrendLength=1)
 Initializes a new instance of the ZigZag class using default parameters. More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => Samples > _minTrendLength
 Indicates whether the indicator has enough data to produce meaningful output. The indicator is considered "ready" when the number of samples exceeds the minimum trend length. More...
 
int WarmUpPeriod => _minTrendLength + 1
 Gets the number of periods required for the indicator to warm up. This is equal to the minimum trend length plus one additional bar for initialization. More...
 

Protected Member Functions

override decimal ComputeNextValue (IBaseDataBar input)
 Computes the next value of the ZigZag indicator based on the input bar. Determines whether the input bar forms a new pivot or updates the current trend. More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.BarIndicator
 BarIndicator (string name)
 Creates a new TradeBarIndicator with the specified name More...
 

Properties

IndicatorBase< IndicatorDataPointHighPivot [get]
 Stores the most recent high pivot value in the ZigZag calculation. Updated whenever a valid high pivot is identified. More...
 
IndicatorBase< IndicatorDataPointLowPivot [get]
 Stores the most recent low pivot value in the ZigZag calculation. Updated whenever a valid low pivot is identified. More...
 
PivotPointType PivotType [get]
 Represents the current type of pivot (High or Low) in the ZigZag calculation. The value is updated based on the most recent pivot identified: More...
 
- Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

The ZigZag indicator identifies significant turning points in price movements, filtering out noise using a sensitivity threshold and a minimum trend length. It alternates between high and low pivots to determine market trends.

Definition at line 27 of file ZigZag.cs.

Constructor & Destructor Documentation

◆ ZigZag() [1/2]

QuantConnect.Indicators.ZigZag.ZigZag ( string  name,
decimal  sensitivity = 0.05m,
int  minTrendLength = 1 
)

Initializes a new instance of the ZigZag class with the specified parameters.

Parameters
nameThe name of the indicator.
sensitivityThe sensitivity threshold as a decimal value between 0 and 1.
minTrendLengthThe minimum number of bars required to form a valid trend.

Definition at line 84 of file ZigZag.cs.

◆ ZigZag() [2/2]

QuantConnect.Indicators.ZigZag.ZigZag ( decimal  sensitivity = 0.05m,
int  minTrendLength = 1 
)

Initializes a new instance of the ZigZag class using default parameters.

Parameters
sensitivityThe sensitivity threshold as a decimal value between 0 and 1.
minTrendLengthThe minimum number of bars required to form a valid trend.

Definition at line 107 of file ZigZag.cs.

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.ZigZag.ComputeNextValue ( IBaseDataBar  input)
protected

Computes the next value of the ZigZag indicator based on the input bar. Determines whether the input bar forms a new pivot or updates the current trend.

Parameters
inputThe current bar of market data used for the calculation.
Returns
The value of the most recent pivot, either a high or low, depending on the current trend.

Definition at line 132 of file ZigZag.cs.

◆ Reset()

override void QuantConnect.Indicators.ZigZag.Reset ( )

Resets this indicator to its initial state

Definition at line 199 of file ZigZag.cs.

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.ZigZag.IsReady => Samples > _minTrendLength

Indicates whether the indicator has enough data to produce meaningful output. The indicator is considered "ready" when the number of samples exceeds the minimum trend length.

Definition at line 116 of file ZigZag.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.ZigZag.WarmUpPeriod => _minTrendLength + 1

Gets the number of periods required for the indicator to warm up. This is equal to the minimum trend length plus one additional bar for initialization.

Definition at line 122 of file ZigZag.cs.

Property Documentation

◆ HighPivot

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.ZigZag.HighPivot
get

Stores the most recent high pivot value in the ZigZag calculation. Updated whenever a valid high pivot is identified.

Definition at line 64 of file ZigZag.cs.

◆ LowPivot

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.ZigZag.LowPivot
get

Stores the most recent low pivot value in the ZigZag calculation. Updated whenever a valid low pivot is identified.

Definition at line 70 of file ZigZag.cs.

◆ PivotType

PivotPointType QuantConnect.Indicators.ZigZag.PivotType
get

Represents the current type of pivot (High or Low) in the ZigZag calculation. The value is updated based on the most recent pivot identified:

Definition at line 76 of file ZigZag.cs.


The documentation for this class was generated from the following file: