q.label.trend_scanning fits forward linear regressions over several candidate bar horizons. For each event it keeps the slope with the largest absolute t-value and assigns a directional label when that statistic exceeds min_t_value.
A horizon of 5 means five bars after the event and therefore fits six prices including the event itself.
Markers show the selected trend direction at each event. Shaded intervals end at each regression’s chosen horizon, so variable label lifetimes remain visible.