Trend & direction

Time Series Forecast · TSF

A moving line drawn from the endpoint of a rolling linear regression — a low-lag trend track, also called the moving linear regression.

Works best in trending marketsEngine-computed on a fixed sample series
14512096Price above EMA 12 = strengthPrice below EMA 12 = weaknessEMA 12 acts as support / resistance
EMA 12EMA 26How to read TSF on the chart — the callouts mark what to look for.

The formula

Fit a straight line y = a + b·x by least squares through the last N closes, then read its value at the current bar. Also called the moving linear regression, it uses the fitted slope to lean into the trend, so it tracks price with less lag than an SMA of the same length.

TSF = a + b × x (the least-squares line read at the latest bar)
Worked example
Bar (x)Close (y)Fitted line
0109.8
11111.0
21212.2
31313.4
41514.6

Slope b = 1.2, intercept a = 9.8 → TSF endpoint = 9.8 + 1.2 × 4 = 14.6

What it is

The Time Series Forecast, or TSF, is a trend-tracking line that behaves like a fast, low-lag moving average, and it is also known as the moving linear regression. Instead of averaging past prices, it fits a straight regression line to the most recent stretch of closes and plots where that line sits at the current bar. Because it uses the slope of the recent trend to place its value, it hugs price more closely and reacts sooner than a simple moving average of the same length. To a beginner it answers: where is the underlying trend right now, with as little delay as possible? It gives you the smoothing benefit of a moving average while shaving off much of the lag that makes ordinary averages feel slow. The trade-off, as always, is that speed brings a little more sensitivity to sudden reversals.

How it's calculated

For every bar, TSF looks back over the last N closes and computes the least-squares regression line — the single straight line that minimises the total squared distance to those N prices, defined by an intercept and a slope. It then evaluates that line at the most recent point in the window, the endpoint, and plots that value; some implementations add one bar of the slope to project the line one step forward, which is the sense in which it forecasts. The endpoint value reflects both where price has been and how fast it has been moving, because the slope pulls the line toward the direction of the recent drift. This is why TSF leads a simple moving average: an SMA effectively sits at the centre of its window and lags by roughly half the length, whereas the regression endpoint is projected all the way to the current bar. The whole calculation rolls forward one bar at a time, refitting the line on each new close. The slope is a valuable by-product, indicating the trend's steepness and direction.

Reading it step by step

Treat the TSF line as a responsive trend track. When price trades above a rising TSF, the uptrend is healthy and intact; when price sits below a falling TSF, a downtrend is in force. The slope is as important as the level — a steepening line signals accelerating momentum, while a flattening line warns the trend is losing its footing and may be about to roll over. Crossovers of price and the TSF line arrive earlier than crossovers with a lagging SMA, giving quicker but slightly noisier signals. A TSF that turns over from up to down, or vice versa, marks a shift in the recent regression slope and often precedes a visible change in trend. Because it extrapolates, watch for it to overshoot at sharp turns — a fast reversal can leave the line briefly pointing the wrong way before it snaps back.

Reading the signals on the chart

14512096
EMA 12EMA 26The ▲/▼ marks flag where price most recently crossed the line — the cues a trend-follower would act on.

Best timeframes

  • Scalping1m – 5mnoisy, overshoots
  • Day trading5m – 15m
  • Swing1h – Daily14–20 length
  • PositionDaily – Weeklylonger, smoother

A 14–20 period balances responsiveness against whipsaw; the slope of the line matters as much as its level.

TSF vs other trend lines

TSFLSMASMA
Core ideaRegression endpointRegression endpointMean of closes
LagLowLowHigh
Overshoot riskHigherHigherLower
Relationship≈ LSMA≈ TSFSlower than both

Common price-action setups

How the signal typically plays out on the chart.

Price crosses TSF

Price closing back above a flattening-to-rising TSF signals the trend turning up — buy the cross with a stop below the recent swing low.

Buy the cross
Trend turns up
Pullback to TSF

In an uptrend price dips to the rising TSF and resumes — enter on the bounce with a stop just under the line.

Buy the dip
Bullish continuation
Slope rollover

When a rising TSF flattens and price closes below it, momentum is fading — exit longs or short the breakdown with a stop above the line.

Sell the cross
Trend turns down

Best timeframes and settings

The default length is commonly 14 to 20 periods, which balances responsiveness against noise on daily and 4-hour charts favoured by swing traders. Shortening the length — say to 8 or 10 — makes the line cling even tighter to price and react faster, at the cost of more whipsaws and false turns. Lengthening it toward 30 or 50 smooths the line and steadies the slope, better for position trading but slower to flag reversals. On intraday scalping timeframes a short TSF can act as a dynamic pullback reference, while on weekly charts a longer TSF traces the primary trend. The core trade-off is universal: more responsiveness means more noise, more smoothing means more lag. Because TSF already leads an SMA of the same length, you can often run it a touch longer than you would an SMA and still get comparable timeliness with less jitter.

When and where to use it

TSF is a trend tool, so it earns its keep in trending markets where the regression slope is meaningful and price respects the line on pullbacks. In a flat, ranging market the slope hovers near zero, the line drifts sideways, and price crosses it repeatedly without follow-through, generating whipsaws. It works on any liquid instrument — equities, futures, forex, and crypto — and its low lag makes it popular where getting in and out promptly matters. Avoid leaning on it as a standalone signal at obvious turning points, because its extrapolation is precisely where it is weakest. Use it when you want an early, smooth read on trend direction and a dynamic level to trade pullbacks against. Reserve range-bound conditions for oscillators and horizontal levels instead.

Strategies that use it

A pullback strategy uses TSF as a dynamic support-or-resistance line: in an uptrend with a rising TSF, buy when price dips to touch the line and holds, with a stop just beyond it, targeting the prior swing high. A crossover strategy trades price crossing the TSF: go long when price closes above a rising line and exit or reverse when it closes below a falling one, accepting that the early signals include some false starts. A slope strategy ignores price crossings and trades the line's own turn — enter in the direction of the new slope once the TSF changes direction and hold while the slope persists, exiting when it flattens. A common refinement pairs TSF with a slower moving average and only takes signals in the direction of that slower trend, filtering out counter-trend whipsaws. Across all of these, the flattening of the line is your early warning to tighten risk.

Combining it with other indicators

TSF pairs naturally with the Forecast Oscillator, which measures the percentage gap between price and the TSF and effectively times pullbacks to the line. A longer-period moving average or the ADX makes a good regime filter, so you only take TSF signals when a real trend is present and stand aside when ADX is low. Momentum tools such as RSI or MACD confirm the strength behind a TSF crossover and warn of divergence when price and the line disagree with underlying momentum. Because TSF is closely related to the least-squares moving average, using both is redundant — pick one. Support-and-resistance levels and volume help you separate a genuine TSF breakout from a false one. The line also complements a moving-average ribbon, where TSF acts as the fastest, leading strand.

Where it fails

TSF's defining weakness is the flip side of its strength: because it extrapolates the recent slope, it overshoots and whipsaws when a trend reverses abruptly, briefly projecting the old direction into the new one. It remains a lagging construct in substance — the projection assumes the recent slope continues, an assumption that breaks precisely at turning points. In ranging markets the near-zero slope produces a flat line that price chops across, spraying false crossover signals. Shortening the length to chase responsiveness magnifies all of this. The classic mistake is trading every price-line crossover mechanically in a sideways market and getting churned. Avoid it by confirming a trend regime first, using the slope rather than the crossing as your primary read, and combining TSF with an independent trend filter.

A worked example

Suppose a stock's last 14 daily closes rise steadily from about 48 to 50.30, and a least-squares fit through them yields a slope of about +0.18 per bar with an endpoint value of 50.25 — that is today's TSF. A simple 14-period moving average of the same closes sits lower, near 49.55, because it lags toward the middle of the window. Today's price is 50.45, above the rising TSF at 50.25, confirming a healthy uptrend, and the fact that TSF leads the SMA by 0.70 shows how much lag it has removed. You buy the next shallow dip that holds the line near 50.25, with a stop at 49.50 just under the SMA and recent structure, risking about 0.75. Two weeks later the closes flatten, the regression slope falls toward +0.02, and the TSF line goes flat near 52.10 — your cue that momentum has stalled, so you tighten the stop beneath the most recent swing low and prepare to exit.

Common mistakes

  • Trusting the projection at turning points — TSF assumes the recent slope continues and overshoots when price suddenly reverses.
  • Using too short a length, which makes the line whip around on noise.
  • Treating it as leading — it is still a lagging construct, just lower-lag than an SMA.
  • Pairing TSF with an LSMA and thinking you have confirmation; they are nearly the same line.
  • Ignoring the slope and trading flat-line crosses that carry no trend.
  • Forgetting it is computed on closes, so it only updates at the bar close.