indicator
indicator
Modules:
| Name | Description |
|---|---|
child_when |
|
core |
|
managed |
|
Classes:
| Name | Description |
|---|---|
ChildWhen |
When a child indicator is calculated relative to its parent. |
Indicator |
|
Managed |
Managed |
State |
Internal state backed by a managed child indicator. |
Indicator
dataclass
Indicator(
*,
candles: list[Candle] = list(),
name: str = "",
timeframe: TimeFramesSource | None = None,
timeframe_fill: bool = False,
candle_life: timedelta | None = None,
candlestick: CandlestickType | str | None = None,
rounding: int | None = 4
)
Methods:
| Name | Description |
|---|---|
add_child |
Register a child indicator that shares this indicator's candles. |
add_child_after |
Register a child calculated after the parent's reading is stored. |
add_child_managed |
Register a child calculated only when explicitly invoked. |
add_state |
Register hidden state storage for incremental calculations. |
append |
Appends a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap. |
at |
Reading at a specific candle index — shorthand for |
at_src |
Reading at |
calculate |
Calculate the TA values, will calculate for all the Candles, |
calculate_index |
Calculate the TA values, will calculate a index range the Candles, will re-calculate |
insert |
insert a Candle or a list of Candle's to the Indicator Candles. This accepts any order or placement. This will sort, re-sample and re-calculate all Candles. |
prepend |
Prepends a Candle or a chronological ordered list of Candle's to the front of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap. |
prev |
Previous reading — shorthand for |
prev_src |
Previous reading for this indicator's configured |
reading |
Simple method to get an indicator reading from the index |
reading_count |
Returns how many instance of the given indicator exist |
reading_period |
Will return True if the given indicator goes back as far as amount, |
recalculate |
Re-calculate this indicator value for all Candles |
series |
Retrieve the indicator readings for within the candles as a list. |
src |
Current reading for this indicator's configured |
Attributes:
| Name | Type | Description |
|---|---|---|
candle_manager |
CandleManager
|
The Candle Manager which controls TimeFrame, Trimming and collapsing |
settings |
dict
|
Retrieve the settings required to regenerate this indicator in a dictionary format. |
candle_manager
property
writable
candle_manager: CandleManager
The Candle Manager which controls TimeFrame, Trimming and collapsing
settings
property
settings: dict
Retrieve the settings required to regenerate this indicator in a dictionary format.
This property compiles the configuration details of the indicator, excluding attributes that are irrelevant for generation (e.g., candles and sub-indicators). It ensures the output dictionary is clean and contains only the necessary settings for recreating the indicator.
Special handling is included for attributes like candlestick and timeframe, ensuring
their values are properly formatted.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing the indicator's settings, ready for regeneration.
- |
add_child
Register a child indicator that shares this indicator's candles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indicator
|
Indicator
|
The child indicator to attach. |
required |
when
|
ChildWhen | str
|
When the child is calculated relative to the parent at each index.
:attr: |
BEFORE
|
Source code in hexital/core/indicator/core.py
add_child_after
Register a child calculated after the parent's reading is stored.
add_child_managed
Register a child calculated only when explicitly invoked.
Source code in hexital/core/indicator/core.py
add_state
Register hidden state storage for incremental calculations.
Source code in hexital/core/indicator/core.py
append
Appends a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to append. |
required |
Source code in hexital/core/indicator/core.py
at
at(
index: int, source: Source | None = None, default: T | None = None
) -> V | T
Reading at a specific candle index — shorthand for reading.
at_src
at_src(index: int, default: T | None = None) -> V | T
Reading at index for this indicator's configured source.
calculate
Calculate the TA values, will calculate for all the Candles, where this indicator is missing
Source code in hexital/core/indicator/core.py
calculate_index
Calculate the TA values, will calculate a index range the Candles, will re-calculate
Source code in hexital/core/indicator/core.py
insert
insert a Candle or a list of Candle's to the Indicator Candles. This accepts any order or placement. This will sort, re-sample and re-calculate all Candles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to prepend. |
required |
Source code in hexital/core/indicator/core.py
prepend
Prepends a Candle or a chronological ordered list of Candle's to the front of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to prepend. |
required |
Source code in hexital/core/indicator/core.py
prev
prev_src
Previous reading for this indicator's configured source.
reading
reading(
source: Source | None = None,
index: int | None = None,
default: T | None = None,
) -> V | T
Simple method to get an indicator reading from the index
Source code in hexital/core/indicator/core.py
reading_count
Returns how many instance of the given indicator exist
Source code in hexital/core/indicator/core.py
reading_period
Will return True if the given indicator goes back as far as amount, It's true if exactly or more than. Period will be period -1
Source code in hexital/core/indicator/core.py
recalculate
series
series(name: Source | None = None) -> list[Reading | V]
Retrieve the indicator readings for within the candles as a list.
This method collects the readings of a specified indicator for all candles and returns them as a list. If no name is provided, the generated name of the indicator is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the indicator to retrieve.
Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
list[Reading | V]
|
List[float | dict | None]: A list containing the indicator values for
each candle. The values may be floats,
dictionaries (for complex indicators),
or |
Source code in hexital/core/indicator/core.py
src
Managed
dataclass
Managed(
*,
candles: list[Candle] = list(),
name: str = "",
timeframe: TimeFramesSource | None = None,
timeframe_fill: bool = False,
candle_life: timedelta | None = None,
candlestick: CandlestickType | str | None = None,
rounding: int | None = 4
)
Bases: Indicator
Managed
Empty Indicator thats manually controlled and the reading manually set.
Methods:
| Name | Description |
|---|---|
add_child |
Register a child indicator that shares this indicator's candles. |
add_child_after |
Register a child calculated after the parent's reading is stored. |
add_child_managed |
Register a child calculated only when explicitly invoked. |
add_state |
Register hidden state storage for incremental calculations. |
append |
Appends a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap. |
at |
Reading at a specific candle index — shorthand for |
at_src |
Reading at |
calculate |
Calculate the TA values, will calculate for all the Candles, |
calculate_index |
Calculate the TA values, will calculate a index range the Candles, will re-calculate |
insert |
insert a Candle or a list of Candle's to the Indicator Candles. This accepts any order or placement. This will sort, re-sample and re-calculate all Candles. |
prepend |
Prepends a Candle or a chronological ordered list of Candle's to the front of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap. |
prev |
Previous reading — shorthand for |
prev_src |
Previous reading for this indicator's configured |
reading |
Simple method to get an indicator reading from the index |
reading_count |
Returns how many instance of the given indicator exist |
reading_period |
Will return True if the given indicator goes back as far as amount, |
recalculate |
Re-calculate this indicator value for all Candles |
series |
Retrieve the indicator readings for within the candles as a list. |
src |
Current reading for this indicator's configured |
Attributes:
| Name | Type | Description |
|---|---|---|
candle_manager |
CandleManager
|
The Candle Manager which controls TimeFrame, Trimming and collapsing |
settings |
dict
|
Retrieve the settings required to regenerate this indicator in a dictionary format. |
candle_manager
property
writable
candle_manager: CandleManager
The Candle Manager which controls TimeFrame, Trimming and collapsing
settings
property
settings: dict
Retrieve the settings required to regenerate this indicator in a dictionary format.
This property compiles the configuration details of the indicator, excluding attributes that are irrelevant for generation (e.g., candles and sub-indicators). It ensures the output dictionary is clean and contains only the necessary settings for recreating the indicator.
Special handling is included for attributes like candlestick and timeframe, ensuring
their values are properly formatted.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing the indicator's settings, ready for regeneration.
- |
add_child
Register a child indicator that shares this indicator's candles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indicator
|
Indicator
|
The child indicator to attach. |
required |
when
|
ChildWhen | str
|
When the child is calculated relative to the parent at each index.
:attr: |
BEFORE
|
Source code in hexital/core/indicator/core.py
add_child_after
Register a child calculated after the parent's reading is stored.
add_child_managed
Register a child calculated only when explicitly invoked.
Source code in hexital/core/indicator/core.py
add_state
Register hidden state storage for incremental calculations.
Source code in hexital/core/indicator/core.py
append
Appends a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to append. |
required |
Source code in hexital/core/indicator/core.py
at
at(
index: int, source: Source | None = None, default: T | None = None
) -> V | T
Reading at a specific candle index — shorthand for reading.
at_src
at_src(index: int, default: T | None = None) -> V | T
Reading at index for this indicator's configured source.
calculate
Calculate the TA values, will calculate for all the Candles, where this indicator is missing
Source code in hexital/core/indicator/core.py
calculate_index
Calculate the TA values, will calculate a index range the Candles, will re-calculate
Source code in hexital/core/indicator/core.py
insert
insert a Candle or a list of Candle's to the Indicator Candles. This accepts any order or placement. This will sort, re-sample and re-calculate all Candles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to prepend. |
required |
Source code in hexital/core/indicator/core.py
prepend
Prepends a Candle or a chronological ordered list of Candle's to the front of the Indicator Candle's. This will only re-sample and re-calculate the new Candles, with minor overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candles
|
Candles
|
The Candle or List of Candle's to prepend. |
required |
Source code in hexital/core/indicator/core.py
prev
prev_src
Previous reading for this indicator's configured source.
reading
reading(
source: Source | None = None,
index: int | None = None,
default: T | None = None,
) -> V | T
Simple method to get an indicator reading from the index
Source code in hexital/core/indicator/core.py
reading_count
Returns how many instance of the given indicator exist
Source code in hexital/core/indicator/core.py
reading_period
Will return True if the given indicator goes back as far as amount, It's true if exactly or more than. Period will be period -1
Source code in hexital/core/indicator/core.py
recalculate
series
series(name: Source | None = None) -> list[Reading | V]
Retrieve the indicator readings for within the candles as a list.
This method collects the readings of a specified indicator for all candles and returns them as a list. If no name is provided, the generated name of the indicator is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the indicator to retrieve.
Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
list[Reading | V]
|
List[float | dict | None]: A list containing the indicator values for
each candle. The values may be floats,
dictionaries (for complex indicators),
or |
Source code in hexital/core/indicator/core.py
src
State
Internal state backed by a managed child indicator.
Use via Indicator.add_state() rather than constructing directly.
Dictionary keys map to fields stored on each candle's sub_indicators.
Methods:
| Name | Description |
|---|---|
prev |
Previous reading for the whole state or a single field. |
reading |
Current reading for the whole state or a single field. |
set |
Replace the stored state for the current or given candle. |
source |
Reference a state field as an indicator source. |
update |
Merge fields into dict state for the current or given candle. |
Attributes:
| Name | Type | Description |
|---|---|---|
managed |
Managed
|
Underlying managed child, e.g. as an EMA |
Source code in hexital/core/indicator/managed.py
prev
prev(key: str | None = None, default: T | None = None) -> Reading | T
Previous reading for the whole state or a single field.
Source code in hexital/core/indicator/managed.py
reading
reading(key: str | None = None, default: T | None = None) -> Reading | T
Current reading for the whole state or a single field.
Source code in hexital/core/indicator/managed.py
set
set(reading: Reading, index: int | None = None) -> None
Replace the stored state for the current or given candle.
update
update(index: int | None = None, **values: Reading) -> None
Merge fields into dict state for the current or given candle.