Skip to content

PivotPointsHighLow

QuantConnect.Indicators.PivotPointsHighLow

PivotPointsHighLow(
    surrounding_bars_count: int,
    last_stored_values: int = 100,
)
PivotPointsHighLow(
    surrounding_bars_count_for_high_point: int,
    surrounding_bars_count_for_low_point: int,
    last_stored_values: int = 100,
    strict: bool = True,
)
PivotPointsHighLow(
    name: str,
    surrounding_bars_count_for_high_point: int,
    surrounding_bars_count_for_low_point: int,
    last_stored_values: int = 100,
    strict: bool = True,
)

Bases: IndicatorBase[IBaseDataBar], IIndicatorWarmUpPeriodProvider

Pivot Points (High/Low), also known as Bar Count Reversals, indicator. https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/pivot-points-high-low

Signature descriptions:

  • Creates a new instance of PivotPointsHighLow indicator with an equal high and low length

  • Creates a new instance of PivotPointsHighLow indicator

Parameters:

Name Type Description Default
surrounding_bars_count Optional[int]

The length parameter here defines the number of surrounding bars that we compare against the current bar high and lows for the max/min

None
last_stored_values int

The number of last stored indicator values

100
surrounding_bars_count_for_high_point Optional[int]

The number of surrounding bars whose high values should be less than the current bar's for the bar high to be marked as high pivot point

None
surrounding_bars_count_for_low_point Optional[int]

The number of surrounding bars whose low values should be more than the current bar's for the bar low to be marked as low pivot point

None
strict Optional[bool]

When true (default), uses strict inequalities (> and <). When false, uses relaxed inequalities (>= and <=) allowing equal values to be detected as pivot points.

True
name Optional[str]

The name of an indicator

None

new_pivot_point_formed

new_pivot_point_formed: _EventContainer[
    Callable[[Object, PivotPointsEventArgs], Any], Any
]

Event informs of new pivot point formed with new data update

is_ready

is_ready: bool

Gets a flag indicating when this indicator is ready and fully initialized

warm_up_period

warm_up_period: int

Required period, in data points, for the indicator to be ready and fully initialized.

consolidators

consolidators: ISet[IDataConsolidator]

The data consolidators associated with this indicator if any

current

Gets the current state of this indicator. If the state has not been updated then the time on the value will equal DateTime.MinValue.

previous

Gets the previous state of this indicator. If the state has not been updated then the time on the value will equal DateTime.MinValue.

name

name: str

Gets a name for this indicator

samples

samples: int

Gets the number of samples processed by this indicator

updated

updated: _EventContainer[
    Callable[[Object, IndicatorDataPoint], Any], Any
]

Event handler that fires after this indicator is updated

window

A rolling window keeping a history of the indicator values of a given period

compute_next_value

compute_next_value(input: IBaseDataBar) -> float

Computes the next value of this indicator from the given state

This codeEntityType is protected.

Parameters:

Name Type Description Default
input IBaseDataBar

The input given to the indicator

required

Returns:

Type Description
float

A new value for this indicator.

convert_to_computed_value

convert_to_computed_value(
    high_point: PivotPoint, low_point: PivotPoint
) -> float

Method for converting high and low pivot points to a decimal value.

This codeEntityType is protected.

Parameters:

Name Type Description Default
high_point PivotPoint

new high point or null

required
low_point PivotPoint

new low point or null

required

Returns:

Type Description
float

a decimal value representing the values of high and low pivot points.

find_next_high_pivot_point

find_next_high_pivot_point(
    window_highs: RollingWindow[IBaseDataBar],
    mid_point_index_or_surrounding_bars_count: int,
) -> PivotPoint

Looks for the next high pivot point.

This codeEntityType is protected.

Parameters:

Name Type Description Default
window_highs RollingWindow[IBaseDataBar]

rolling window that tracks the highs

required
mid_point_index_or_surrounding_bars_count int

The midpoint index or surrounding bars count for highs

required

Returns:

Type Description
PivotPoint

pivot point if found else null.

find_next_low_pivot_point

find_next_low_pivot_point(
    window_lows: RollingWindow[IBaseDataBar],
    mid_point_index_or_surrounding_bars_count: int,
) -> PivotPoint

Looks for the next low pivot point.

This codeEntityType is protected.

Parameters:

Name Type Description Default
window_lows RollingWindow[IBaseDataBar]

rolling window that tracks the lows

required
mid_point_index_or_surrounding_bars_count int

The midpoint index or surrounding bars count for lows

required

Returns:

Type Description
PivotPoint

pivot point if found else null.

get_all_pivot_points_array

get_all_pivot_points_array() -> List[PivotPoint]

Get all pivot points, in the order such that first element in collection is the nearest to the present date

Returns:

Type Description
List[PivotPoint]

An array of low and high pivot points. Ordered by time in descending order.

get_high_pivot_points_array

get_high_pivot_points_array() -> List[PivotPoint]

Get current high pivot points, in the order such that first element in collection is the nearest to the present date

Returns:

Type Description
List[PivotPoint]

An array of high pivot points.

get_low_pivot_points_array

get_low_pivot_points_array() -> List[PivotPoint]

Get current low pivot points, in the order such that first element in collection is the nearest to the present date

Returns:

Type Description
List[PivotPoint]

An array of low pivot points.

reset

reset() -> None

Resets this indicator to its initial state

__eq__

__eq__(right: float) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: float) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: int) -> bool
__eq__(right: IndicatorBase) -> bool
__eq__(right: int) -> bool
__eq__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is equal to the specified value

  • Determines if the specified value is equal to the indicator's current value

__ge__

__ge__(right: float) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: float) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: int) -> bool
__ge__(right: IndicatorBase) -> bool
__ge__(right: int) -> bool
__ge__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is greater than or equal to the specified value

  • Determines if the specified value is greater than or equal to the indicator's current value

__gt__

__gt__(right: float) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: float) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: int) -> bool
__gt__(right: IndicatorBase) -> bool
__gt__(right: int) -> bool
__gt__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is greater than the specified value

  • Determines if the specified value is greater than the indicator's current value

__le__

__le__(right: float) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: float) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: int) -> bool
__le__(right: IndicatorBase) -> bool
__le__(right: int) -> bool
__le__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is less than or equal to the specified value

  • Determines if the specified value is less than or equal to the indicator's current value

__lt__

__lt__(right: float) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: float) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: int) -> bool
__lt__(right: IndicatorBase) -> bool
__lt__(right: int) -> bool
__lt__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is less than the specified value

  • Determines if the specified value is less than the indicator's current value

__ne__

__ne__(right: float) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: float) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: int) -> bool
__ne__(right: IndicatorBase) -> bool
__ne__(right: int) -> bool
__ne__(right: IndicatorBase) -> bool

Signature descriptions:

  • Determines if the indicator's current value is not equal to the specified value

  • Determines if the specified value is not equal to the indicator's current value

compare_to

compare_to(obj: Any) -> int
compare_to(other: IIndicator) -> int

Signature descriptions:

  • Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

  • Compares the current object with another object of the same type.

Parameters:

Name Type Description Default
obj Optional[Any]

An object to compare with this instance.

None
other Optional[IIndicator]

An object to compare with this object.

None

Returns:

Type Description
int

Depends on the signature used. Case 1: [A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj. Greater than zero This instance follows obj in the sort order.]; Case 2: [A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.]

update

update(input: IBaseData) -> bool
update(time: Union[datetime, date], value: float) -> bool

Updates the state of this indicator with the given value and returns true if this indicator is ready, false otherwise

Parameters:

Name Type Description Default
input Optional[IBaseData]

The value to use to update this indicator

None
time Optional[Union[datetime, date]]

The time associated with the value

None
value Optional[float]

The value to use to update this indicator

None

Returns:

Type Description
bool

True if this indicator is ready, false otherwise.

__getitem__

__getitem__(i: int) -> IndicatorDataPoint

Indexes the history windows, where index 0 is the most recent indicator value. If index is greater or equal than the current count, it returns null. If the index is greater or equal than the window size, it returns null and resizes the windows to i + 1.

Parameters:

Name Type Description Default
i int

The index

required

Returns:

Type Description
IndicatorDataPoint

the ith most recent indicator value.

__iter__

__iter__() -> Iterator[IndicatorDataPoint]

equals

equals(obj: Any) -> bool

Determines whether the specified object is equal to the current object.

Parameters:

Name Type Description Default
obj Any

The object to compare with the current object.

required

Returns:

Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

get_enumerator

get_enumerator() -> IEnumerator[IndicatorDataPoint]

Returns an enumerator that iterates through the history window.

Returns:

Type Description
IEnumerator[IndicatorDataPoint]

A System.Collections.Generic.IEnumerator`1 that can be used to iterate through the history window.

get_hash_code

get_hash_code() -> int

Get Hash Code for this Object

Returns:

Type Description
int

Integer Hash Code.

on_updated

on_updated(consolidated: IndicatorDataPoint) -> None

Event invocator for the Updated event

This codeEntityType is protected.

Parameters:

Name Type Description Default
consolidated IndicatorDataPoint

This is the new piece of data produced by this indicator

required

to_detailed_string

to_detailed_string() -> str

Provides a more detailed string of this indicator in the form of {Name} - {Value}

Returns:

Type Description
str

A detailed string of this indicator's current state.

to_string

to_string() -> str

ToString Overload for Indicator Base

Returns:

Type Description
str

String representation of the indicator.

validate_and_compute_next_value

validate_and_compute_next_value(
    input: QuantConnect_Indicators_IndicatorBase_T,
) -> IndicatorResult

Computes the next value of this indicator from the given state and returns an instance of the IndicatorResult class

This codeEntityType is protected.

Parameters:

Name Type Description Default
input QuantConnect_Indicators_IndicatorBase_T

The input given to the indicator

required

Returns:

Type Description
IndicatorResult

An IndicatorResult object including the status of the indicator.