• the reference linreg: the least-squares regression line fitted over the last period values, evaluated offset bars back from its right-hand end.

    x runs 0 (oldest bar in the window) to period-1 (current bar), so the value at the current bar is intercept + slope * (period - 1). A positive offset steps back down that line, which is how LSMA's offset input shifts the plot without recomputing the fit.

    Parameters

    • values: readonly number[]
    • period: number
    • offset: number = 0

    Returns number[]