Standard Deviation
STDDEV measures the amount of variation or dispersion of a set of values.
Method
tm.ta.stddev(source, timeperiod, nbdev)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
timeperiod | int | Number of periods for the indicator | 5 |
nbdev | float | Number of deviations for the indicator | 1 |
Outputs
Output | Type |
---|---|
stddev | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Standard Deviation stddev = tm.ta.stddev(data.close, timeperiod=5, nbdev=1)
# Get the last value and print last_value = stddev.iloc[-1] tm.log(f"Last value of Standard Deviation is {last_value}")
# Plot the values of stddev tm.plot(stddev, title="Standard Deviation", overlay=False)