Linear Regression Angle
LINEARREG_ANGLE calculates the angle of the linear regression line.
Method
tm.ta.linearreg_angle(source, timeperiod)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
timeperiod | int | Number of periods for the indicator | 14 |
Outputs
Output | Type |
---|---|
linearreg_angle | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Linear Regression Angle linearreg_angle = tm.ta.linearreg_angle(data.close, timeperiod=14)
# Get the last value and print last_value = linearreg_angle.iloc[-1] tm.log(f"Last value of Linear Regression Angle is {last_value}")
# Plot the values of linearreg_angle tm.plot(linearreg_angle, title="Linear Regression Angle", overlay=False)