Triangular Moving Average
TRIMA is a moving average that places equal weight on all prices within the period.
Method
tm.ta.trima(source, timeperiod)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
timeperiod | int | Number of periods for the indicator | 30 |
Outputs
Output | Type |
---|---|
trima | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Triangular Moving Average trima = tm.ta.trima(data.close, timeperiod=30)
# Get the last value and print last_value = trima.iloc[-1] tm.log(f"Last value of Triangular Moving Average is {last_value}")
# Plot the values of trima tm.plot(trima, title="Triangular Moving Average", overlay=False)