ema
Calculate the Exponential Moving Average (EMA) for a given symbol.
Syntax
Fields
Description
symbol(str)
Symbol to perform calculation on. Defaults to the first symbol in watchlist
period(int)
Period of EMA. Defaults to 14
interval(str)
Interval to perform the calculation. Defaults to interval of algorithm
ref(str)
'close', 'open', 'high', or 'low'. Defaults to 'close'
prices(list)
When specified, this function will use the values provided in the list to perform calculations and ignore other parameters. Defaults to None
def ema(
self,
symbol: str = None,
period: int = 14,
interval: Interval = None,
ref: str = "close",
prices=None,
) -> np.array:
Returns
Returns a NumPy array containing the EMA values.
Raises
- An
Exception
is raised if the calculation fails due to incorrect parameters or data issues.