ema
ema
Classes:
Name | Description |
---|---|
EMA |
Exponential Moving Average - EMA |
EMA
dataclass
EMA(
*,
candles: List[Candle] = list(),
name: str = "",
timeframe: Optional[TimeFramesSource] = None,
timeframe_fill: bool = False,
candle_life: Optional[timedelta] = None,
candlestick: Optional[CandlestickType | str] = None,
rounding: Optional[int] = 4,
period: int = 10,
source: Source = "close",
smoothing: float = 2.0
)
Bases: Indicator[float | None]
Exponential Moving Average - EMA
The Exponential Moving Average is more responsive moving average compared to the Simple Moving Average (SMA). The weights are determined by alpha which is proportional to it's length.
Sources
https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-calculated.asp
Output type: float
Parameters:
Name | Type | Description | Default |
---|---|---|---|
period
|
int
|
How many Periods to use. Defaults to 10 |
10
|
source
|
str
|
Which input field to calculate the Indicator. Defaults to "close" |
'close'
|
smoothing
|
float
|
Smoothing multiplier for EMA. Defaults to 2.0 |
2.0
|
Methods:
Name | Description |
---|---|
add_managed_indicator |
Adds managed sub indicator, this will not auto calculate with indicator |
add_sub_indicator |
Adds sub indicator, this will auto calculate with indicator |
append |
append a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This wil only re-sample and re-calculate the new Candles, with minor overlap. |
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. |
purge |
Remove this indicator value from all Candles |
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, |
readings |
Retrieve the indicator readings for within the candles as a list. |
recalculate |
Re-calculate this indicator value for all Candles |
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_managed_indicator
Adds managed sub indicator, this will not auto calculate with indicator
Source code in hexital/core/indicator.py
add_sub_indicator
Adds sub indicator, this will auto calculate with indicator
Source code in hexital/core/indicator.py
append
append a Candle or a chronological ordered list of Candle's to the end of the Indicator Candle's. This wil 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.py
calculate
Calculate the TA values, will calculate for all the Candles, where this indicator is missing
Source code in hexital/core/indicator.py
calculate_index
Calculate the TA values, will calculate a index range the Candles, will re-calculate
Source code in hexital/core/indicator.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.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.py
purge
Remove this indicator value from all Candles
Source code in hexital/core/indicator.py
reading
reading(
source: Optional[Source] = None,
index: Optional[int] = None,
default: Optional[T] = None,
) -> Reading | V | T
Simple method to get an indicator reading from the index
Source code in hexital/core/indicator.py
reading_count
Returns how many instance of the given indicator exist
Source code in hexital/core/indicator.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.py
readings
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
|
Optional[str]
|
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 |