Tracing the Bends a Straight Line Can’t: Polynomial Regression Bands + Channel
Ever feel like your moving average always reacts too late, right before a top or a bottom?
Polynomial Regression Bands + Channel is a TradingView indicator that fits a curve to recent price action and builds a moving average by connecting the right end of that curve.
A regular moving average averages past closes into a single line. This indicator doesn’t average anything. Instead, it fits a second-degree curve (think of a parabola) to the last 100 bars. Because the whole curve reshapes itself to match the price action, the line changes direction faster when the market starts to bend into a peak or a trough.
On the chart you get a curve drawn in white, cyan and pink dotted lines, the solid Polynomial LSMA that traces the curve’s right end over time, and upper and lower bands, all at once. It looks busy at first, but as the figure shows, every one of these lines branches off the same single calculation.
What You See on the Polynomial Regression Bands + Channel Chart
The dotted curve and the solid LSMA and bands come from the same calculation. The only difference is whether they draw the current shape or the trail of the right end.
Vowars DE ver.3.23.2
LSMA stands for Least Squares Moving Average. TradingView’s built-in LSMA fits a straight line, while Polynomial Regression Bands + Channel lets you choose the degree of the curve, so you’re not limited to a straight line. That’s the key difference.

I switched through every timeframe on Bitcoin, from the 1-minute to the weekly, and the layout stayed the same on all of them. The background turns black and the candles are painted in four colors. Since the whole color scheme of the chart changes, it can feel like you’ve opened a different chart.
Telling the Lines and Colors Apart
There’s a lot on screen, so let’s first sort out what each element is.
| Element | Appearance | Meaning |
|---|---|---|
| Polynomial regression curve | White dotted line (last 100 bars on the right) | The curve fitted to the last 100 bars. Redrawn every time a new bar prints |
| Upper and lower channel | Cyan and pink dotted lines | The white curve shifted up and down by 2 standard deviations |
| Polynomial LSMA | Thick solid line (green when rising, red when falling) | A line connecting the curve’s right-end value recorded on each bar |
| High Band/Low Band | Thin green and red solid lines | The LSMA plus and minus 2 standard deviations |
| Band fill | Green above the LSMA, red below | Fills between the High Band and the LSMA, and between the LSMA and the Low Band |
| Source / Smoothed Source Value | Thin gray line | The close used in the calculation. Smoothed close by default |
| Candle color | Bright green, dark green, bright red, dark red | Set by position relative to the LSMA and the change from the previous bar |
| Equation label | Black label at the right edge | The equation of the current curve and how many bars it’s shifted |
How the Dotted Curve Relates to the Solid LSMA
The most important thing is the difference between the dotted and solid lines. The white dotted line is “the curve that best fits the last 100 bars as seen from the current bar” Figure 1. The Polynomial LSMA is what you get by recording the value at that curve’s right end (the current bar) one bar at a time Figure 2.
The cyan and pink dotted lines form a channel by shifting the white curve up and down by the same distance Figure 3. Recording that offset at the right end bar by bar gives you the solid High Band and Low Band.
The Four Candle Colors
Candle colors are not based on whether a candle is bullish or bearish. They come from a combination of two things: whether the close is above or below the Polynomial LSMA, and whether the close is higher or lower than the previous close. Check how they line up in the figure.
What the Four Candle Colors Mean
Candle color answers two questions: is the close above or below the LSMA, and is it higher or lower than the previous close?
Vowars DE ver.3.23.2
| Close position | Versus previous close | Candle color |
|---|---|---|
| Above the LSMA | Higher | Bright green |
| Above the LSMA | Unchanged or lower | Dark green |
| Below the LSMA | Lower | Bright red |
| Below the LSMA | Unchanged or higher | Dark red |
The LSMA line itself also turns green when it rises above the previous bar’s LSMA and red when it falls below it Figure 3. Keep them separate in your head: candle color is bar-by-bar momentum, LSMA color is the direction of the curve’s right end.
The chart background turns black because the indicator paints the background black on every bar. Only the area with candles turns black, while the empty space on the right keeps your original background color. The black background stays even if you change your chart theme, so keep an eye on how colors look when you stack other indicators on top.
Reading the Equation Label
The black label at the right edge shows the equation of the curve currently being fitted. For a second-degree curve it takes the form “a + bx + cx^2” with three coefficients. The line below shows how many bars the curve is shifted by Regression Offset.

You don’t need to read the exact coefficients. What matters is whether any coefficient in front of an x term has turned into 0. If you push the period or the degree too high, TradingView’s floating-point precision limit can round the higher-order coefficients down to 0. When that happens, it’s your cue to lower the period or the degree. The label is large and takes up a lot of screen space, so I found it handy to keep it hidden day to day and only turn it on when I change the settings.
How the LSMA and Bands Are Built
Now that you know what’s on screen, let’s dig into why it behaves this way with the figure. If the math doesn’t interest you, there’s no need to memorize it.
How the LSMA and Bands Are Built
Every line on the chart branches off one calculation: fitting a curve to the last 100 bars.
Vowars DE ver.3.23.2
First, the last 100 closes are smoothed with a filter called the Super Smoother. It’s a noise-reduction technique developed by John Ehlers, known for having less lag than a typical moving average. Stripping out the small jitter first keeps the curve fit from getting yanked around by a single long wick.
Next, a second-degree curve is fitted to those 100 smoothed values with least squares Figure 1. Least squares finds “the line that minimizes the sum of the (squared) distances to every bar”, the same idea behind linear regression and TradingView’s built-in LSMA. The difference is that it looks for a curve instead of a straight line.
The value at the right end of that curve becomes the bar’s Polynomial LSMA Figure 2, and adding and subtracting twice the dispersion (standard deviation) of the same 100 bars gives you the bands Figure 3.
The band width is the standard deviation of the 100 values multiplied by Width Coefficient. The way the width is set is close to Bollinger Bands, but the centerline is the right end of the curve, not a simple moving average. So when the market starts to turn, the centerline changes direction first and the whole band tilts sooner.
Dotted Lines Are the Current Fit, Solid Lines Are the Confirmed Record
This is the part to keep in mind when using Polynomial Regression Bands + Channel. The dotted curve is “the fit as seen from the current bar”, so every new bar redraws the whole 100-bar curve from scratch.
The Curve Gets Redrawn, the LSMA Stays
The dotted curve is the fit as seen from the current bar, so it gets redrawn entirely as bars progress. The LSMA and bands keep their confirmed-bar values.
Vowars DE ver.3.23.2
The figure compares the same price action at bar 225 and at bar 250. The curve that looked like it was sloping up at bar 225 Figure 1 has been redrawn into a hump 25 bars later Figure 2. Meanwhile, the Polynomial LSMA and bands keep their confirmed-bar values exactly as they were Figure 3.
The dotted curve is a guide for reading the current shape of the market. Because its shape changes retroactively, looking at old dotted curves that hug price perfectly and concluding “this thing is spot on” is dangerous. Base your decisions on the Polynomial LSMA, High Band, Low Band and candle colors, which don’t change once the bar closes.
Note that on the bar that’s still forming, the LSMA and band values move as the close moves. That’s true of any moving average, and the values lock in at bar close.
How to Use It on the Chart
Polynomial Regression Bands + Channel isn’t an indicator that fires buy or sell signals. It shows you which way the curve is pointing and which side of the curve price is on. After using it for a while, I found that reading it in the following order made decisions easier.
1 Read the Bigger Trend From the LSMA Color
Start by checking whether the Polynomial LSMA is green or red. Green means the right end of the curve is pointing up, red means it’s pointing down. Because it uses a second-degree curve, when an uptrend starts losing steam and rolls into a top, the right end turns down earlier than a straight-line LSMA would.
2 Read Momentum Within the Trend From the Candle Colors
Next, look at the candle colors. This is where reading the LSMA color and the candle color separately pays off. As the figure shows, even if candles turn red during a pullback in an uptrend Figure 1, the uptrend is still intact as long as the LSMA stays green Figure 2.
Read Candle Color and LSMA Color Separately
Candle colors change bar by bar, but the LSMA color reflects the direction of the curve’s right end, so it holds until the trend changes.
Vowars DE ver.3.23.2
On the flip side, when the LSMA itself turns red, it’s a sign the right end of the curve has turned down Figure 3. Treat it as a potential turning point in the trend, a moment to think about taking profits or stepping aside.
3 Use the Bands to Gauge How Far Price Has Stretched From the LSMA
The High Band and Low Band sit at twice the dispersion of the last 100 bars. Price doesn’t reach them very often. When it does, it’s a sign price has stretched well away from the curve. That said, in a strong trend price can ride the band for a long time, so fading the move just because price tagged a band is best avoided.
4 Use the Shape of the Dotted Curve to Read the Current Phase
Finally, look at the shape of the white dotted curve. If it’s concave down (a hump), the uptrend is slowing and starting to roll over. If it’s concave up (a bowl), the selloff is bottoming out and starting to turn up. Since the curve gets redrawn as new bars print, use it to get a feel for “what kind of market structure we’re in right now”, not for exact levels.
In an uptrend, a pullback where the LSMA stays green and candles flip from red back to bright green is one piece of evidence that the uptrend is resuming. For a rally in a downtrend, it’s the mirror image. Don’t act on either one alone. Combine it with key levels such as recent swing highs and lows.
What Changes When You Tweak the Settings?
Polynomial Regression Bands + Channel has a lot of settings, but the ones that really change what you see are the calculation settings at the top.
| Setting | Default | Suggested | Effect |
|---|---|---|---|
| Input Source Value | close | close | The price the curve is fitted to. You can also pick hl2 and others if you prefer the midpoint of the high and low |
| Smooth Data Before Curve Fitting | On | On | Whether to smooth the data with the Super Smoother before fitting. Turning it off uses the raw close and adds more small wiggles to the LSMA and bands |
| Data Smoothing Period | 10 | 5–20 | Smoothing strength. Lower stays closer to price, higher is smoother but lags more |
| Regression Sample Period | 100 | Day trading 50–100, swing 100–200 | Number of bars the curve is fitted to. Shorter makes the LSMA react faster, longer reflects the bigger trend |
| Polynomial Order | 2 | 2 (3 for faster reactions) | Degree of the curve. 1 is a straight line, 2 can form one hump or bowl, 3 can bend twice. Too high makes coefficients more likely to round to 0 |
| Regression Offset | 0 | 0 | Number of bars to shift the curve values. Positive moves right, negative moves left |
| Width Coefficient | 2.0 | 1.5–2.0 | Band width (standard deviation multiplier). Lower makes price touch the bands more often |
| Forecast From _ Bars Ago | 0 | 0 (5–10 when testing) | Uses the curve built from data up to the specified number of bars ago, extended to the current bar, for the LSMA and bands |
| Show Fitted Curve | On | Your preference | Shows the white dotted line (the curve) |
| Show Fitted Channel High | On | Your preference | Shows the cyan dotted line (upper channel) |
| Show Fitted Channel Low | On | Your preference | Shows the pink dotted line (lower channel) |
| Curve Drawing Step Size | 10 | 10 | How many bars each dotted segment spans. Ignored when Auto Decide Step Size Instead is on |
| Auto Decide Step Size Instead | On | On | Uses one-tenth of the period as the step so the curve spans the full period |
| Curve Update Frequency | Continuous | Continuous (Close Only if the chart is slow) | Updates the dotted lines on every tick or only at bar close. Does not affect the LSMA or band calculations |
| Channel High Line Color | Cyan | Default | Color of the upper channel dotted line |
| Channel High Line Width | 3 | 1–3 | Width of the upper channel dotted line |
| Channel High Line Style | Dotted | Dotted | Line style of the upper channel (Solid / Dotted / Dashed) |
| Channel Middle Line Color | White | Default | Color of the middle (curve) dotted line |
| Channel Middle Line Width | 3 | 1–3 | Width of the middle (curve) dotted line |
| Channel Middle Line Style | Dotted | Dotted | Line style of the middle (curve) dotted line |
| Channel Low Line Color | Pink | Default | Color of the lower channel dotted line |
| Channel Low Line Width | 3 | 1–3 | Width of the lower channel dotted line |
| Channel Low Line Style | Dotted | Dotted | Line style of the lower channel dotted line |
| Show Regression Equation | On | Off for daily use | Shows the equation label |
| Equation Label Background Color | Black | Default | Background color of the equation label |
| Equation Label Text Color | White | Default | Text color of the equation label |
| Equation Label Size | Large | Small–Normal | Text size of the equation label (Auto / Tiny / Small / Normal / Large / Huge) |
Polynomial Order Controls How Easily the Curve Bends
Polynomial Order is the setting that changes the display the most. The figure fits the same price action with only the degree changed.
How Polynomial Order Changes the Curve
The same price action fitted with only the degree changed. Higher degrees bend more easily, pulling the LSMA at the right end closer to price.
Vowars DE ver.3.23.2
Set it to 1 and you get a straight-line fit, so even after a sharp drop the LSMA only drifts down slowly Figure 1. At the default of 2 the curve can form one hump, so the right end turns down quickly partway through the decline Figure 2. At 3 the curve can bend twice, so it reacts to the latest bounce even earlier Figure 3.
Higher degrees react faster, but the curve also gets pulled around by small wiggles. At 4 and above the curve tends to overfit and its shape gets unstable, and the higher-order coefficients are more likely to round to 0. In my experience, 2 for everyday use and 3 when you want faster reactions is the comfortable range.
Regression Sample Period Sets How Much History the Curve Sees
Regression Sample Period is the number of bars the curve is fitted to. The figure compares 50 bars with the default of 100.
How Regression Sample Period Changes Curve Length and Responsiveness
Regression Sample Period is the number of bars the curve is fitted to. Shorten it and the curve only looks at recent bars, making the LSMA react faster.
Vowars DE ver.3.23.2
At 50, the dotted curve only covers the last 50 bars Figure 1, and after the sharp drop the LSMA quickly flattened out and even turned green for a while Figure 2. At 100 the fit includes the big peak further back, so the LSMA keeps sliding while staying red Figure 3.
As a rough guide, use 50 to 100 for day trading where you want to follow short-term moves, and 100 to 200 for swing trading on the daily or 4-hour chart where you want to see the bigger trend. Keep in mind that a longer period makes the calculation heavier and makes higher-order coefficients more likely to round to 0.
Forecast From _ Bars Ago Switches to a Projected Track
Enter a number in Forecast From _ Bars Ago and the meaning of the LSMA and bands changes. The curve is built from data up to the specified number of bars ago, and the indicator records that curve extended to the current bar (the projected value).
Switching to a Projected Track With Forecast From
Enter a number in Forecast From _ Bars Ago and the LSMA and bands become a track of projected values: the curve from N bars ago extended to the current bar.
Vowars DE ver.3.23.2
The top panel of the figure is the normal LSMA Figure 1. The bottom panel is the track of projected values from a curve built 10 bars ago and extended to the current bar Figure 2. Right after the sharp drop, the projection stays above price and the gap to actual price action widens Figure 3.
That gap tells you how far ahead your current settings can keep up with price. It works best as a testing tool when you’re dialing in the period and degree. Projected values are not a promise of future prices, so don’t use them as a trade trigger on their own.
Other Settings
Lower Width Coefficient and the bands get narrower, so price touches them more often. At the default of 2.0 price rarely reaches the bands, so if you want to use them as pullback or rally zones, try dropping it to around 1.5.
Regression Offset shifts the curve values left or right to build the LSMA and bands. Positive values move the curve to the right, negative values to the left. Leaving it at 0 is fine for normal use.
If the chart feels slow to load, set Curve Update Frequency to Close Only or turn off the dotted lines. Those dotted lines are the heaviest part for the chart, and turning them off doesn’t change the LSMA, the bands or the candle colors.
Setting Combinations by Use Case
| Use case | Regression Sample Period | Polynomial Order | Width Coefficient | Rationale |
|---|---|---|---|---|
| Track direction quickly on lower timeframes | 50 | 2 | 2.0 | Fewer bars for a faster LSMA |
| Standard for 1-hour to 4-hour charts | 100 | 2 | 2.0 | Default settings. Read both the curve and the record |
| Catch tops and bottoms early | 100 | 3 | 2.0 | The curve can bend twice, so it reacts to direction changes sooner |
| See the bigger trend on daily and above | 150〜200 | 2 | 2.0 | Captures long-term highs and lows with a single curve |
| Use the bands as pullback and rally zones | 100 | 2 | 1.5 | Narrower bands so price touches them more often |
Whichever combination you pick, first load it on the symbols and timeframes you trade most, and check that the timing of the LSMA color changes matches your own trade frequency before relying on it.
Where It Shines and Where It Needs Extra Care
Polynomial Regression Bands + Channel is at its best when the trend bends from up to down or from down to up. Right before tops and bottoms, where straight lines tend to lag, the right end of the curve turns first, so you can spot trend reversals early. The same read works on assets like gold or stock indices that tend to run in big trends before turning.
Since the dotted curve traces the shape of 100 bars, I found the 1-hour to daily range the easiest to work with. On higher timeframes like the weekly, the 100-bar dispersion gets large after a strong trend and the bands widen a lot. On the weekly you can even see the Low Band stretch below 0, which makes the bands less useful as a reference.

On the other hand, low-range sideways markets need extra care. Price crosses back and forth over the LSMA, so the candle colors and the LSMA color flip at short intervals. The next section shows how to tell whether those color changes have real volume behind them.
Where It Helps
- Because it fits a curve, it turns earlier than a straight-line LSMA right before tops and bottoms
- The LSMA, bands and candle colors don’t change after bar close, so they work for backtesting
- The dotted curve shows at a glance whether the market is forming a hump or a bowl
- Degree and period let you fine-tune how fast it reacts
- Forecast From _ Bars Ago lets you check for yourself how well the curve tracks price
What to Watch Out For
- The dotted curve is redrawn every bar, so don’t judge from its past shape
- In ranging markets, the candle colors and LSMA color flip frequently
- Setting the period or degree too high can round coefficients to 0 and break the drawing
- Showing the dotted lines is heavy and can slow down chart loading
- It paints the background black, which may clash with other indicators’ colors
Is There Volume Behind the Color Change? Confirm It With Elder’s Force Index
Both the candle colors and the LSMA color are calculated from price alone. That means a small pullback on thin volume and a full-blown selloff on heavy volume get painted the same red. Polynomial Regression Bands + Channel alone can’t tell the two apart. So I added Elder’s Force Index (EFI) in a separate pane below. It multiplies the size of the price move by volume to show how much force is behind each bar.
Confirming the Reversal With Elder's Force Index
When the LSMA or candle color changes, Polynomial Regression Bands + Channel alone can't tell you whether volume is behind the move. Adding Elder's Force Index in a lower pane shows what's really driving the turn.
Vowars DE ver.3.23.2
In the pullback on the left side of the figure, the candles turn red Figure 1, but EFI stays near 0, so the selling pressure isn’t strong Figure 2. On the right, where the LSMA turns red, EFI also drops well below 0, showing that the selling is backed by volume Figure 3.
There are only two things to read. If candles turn red but EFI stays near 0, treat it as a temporary pullback and wait. If EFI moves far away from 0 around the bar where the LSMA color flips, treat it as confirmation of the trend change. Direction from the LSMA color, conviction from EFI: being able to split the roles like that is what makes this pairing work.
Because Elder’s Force Index uses volume in its calculation, it throws an error and won’t display on symbols where no volume data is provided. On forex and CFD symbols, also keep in mind that whether volume exists, and what it represents, depends on the data provider.
Here are a few other indicators that look like a good match.
- Volatility Stop places a stop an ATR-based distance away from price and flips direction when price breaks through it. Polynomial Regression Bands + Channel has no exit guide of its own, so this gives you a reference for locking in profits or placing stops while the LSMA is green.
- Williams Alligator tells ranges from trends by whether its three smoothed lines are tangled or fanned out. If you make a rule not to trade candle color flips while the lines are tangled, the color whipsaws in ranging markets will throw you around much less.
Things to Know Before You Use It
Polynomial Regression Bands + Channel has no built-in buy or sell signals or alert conditions. If you want notifications, pick this indicator in the “Condition” field of TradingView’s Create Alert dialog, and you can set alerts on things like price crossing the Polynomial LSMA or the bands.
Because the dotted curve gets redrawn as bars progress, what you see on a historical chart is different from what you would have seen in real time. When backtesting, use the LSMA, bands and candle colors, which don’t change after the bar closes. If you step through bars one at a time in Bar Replay, you can watch the curve being redrawn and the LSMA being recorded side by side. Heavy settings can make Bar Replay slow to load, though.
If the calculation takes too long, the chart may show an error. In that case, try these in order: reload the chart, turn off the dotted lines, set Curve Update Frequency to Close Only, then lower the period or degree.
The Polynomial LSMA color and band touches are just inputs for reading market conditions. There’s no guarantee the fit that worked so far will keep working. Decide your stop placement and position sizing first, and use it together with other evidence. This article is not investment advice.
For Traders Who Want to See Moving Averages as Curves
Polynomial Regression Bands + Channel takes the moving average idea one step further: it fits a curve to recent price action and records the curve’s right end. You get a two-layer read: the dotted curve for the current shape of the market, and the solid Polynomial LSMA plus candle colors for direction and momentum.
ImageThere’s a lot on screen, but once you remember that dotted lines are “the current fit” and solid lines are “the confirmed record”, it’s easy to read. If moving-average lag around tops and bottoms bugs you, start by loading it with the default settings on the 1-hour or 4-hour chart and compare when the LSMA changes color with your usual moving average.








