Skip to content

Linear Regression Intercept

Linear regression Intercept indicates the value of the price when the value of the time series is 0.

Method

tm.ta.linearreg_intercept(source, timeperiod)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-
timeperiodintNumber of periods for the indicator14

Outputs

OutputType
linearreg_interceptnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out
linearreg_intercept = tm.ta.linearreg_intercept(data.close, timeperiod=14)
# Get the last value and print
last_value = linearreg_intercept.iloc[-1]
tm.log(f"Last value of is {last_value}")
# Plot the values of linearreg_intercept
tm.plot(linearreg_intercept, title="", overlay=False)