MESA Adaptive Moving Average
MAMA is an adaptive moving average designed to capture trends in varying market conditions.
Method
Section titled “Method”tm.ta.mama(source, fastlimit, slowlimit)Inputs
Section titled “Inputs”| Parameter | Argument type | Description | Default Value |
|---|---|---|---|
| source | pd.Series | Input data series | - |
| fastlimit | float | Fast limit for the indicator | 0 |
| slowlimit | float | Slow limit for the indicator | 0 |
Outputs
Section titled “Outputs”| Output | Type |
|---|---|
| mama | np.ndarray |
| fama | np.ndarray |
Example usage
Section titled “Example usage”import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out MESA Adaptive Moving Average mama, fama = tm.ta.mama(data.close, fastlimit=0, slowlimit=0)
# Get the last value and print last_value = mama.iloc[-1] tm.log(f"Last value of MESA Adaptive Moving Average is {last_value}")
# Plot the values of mama tm.plot(mama, title="MESA Adaptive Moving Average", overlay=False)