Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Pivot Point SuperTrend

Pivot Point SuperTrend, explained from the source

"Pivot Point SuperTrend" by LonesomeTheBlue is one of the most-boosted free trend scripts on TradingView, with more than 29,000 boosts. It looks like a SuperTrend, but the middle of its bands is not price. It is a running average of recent swing highs and lows, with ATR bands drawn around that average and a trailing line that follows whichever band is on the trend side.

How it works

  1. Find pivots. A pivot high is a bar whose high is above the highs of the bars on each side; a pivot low is the mirror. The "Pivot Point Period" (default 2) is how many bars on each side. A pivot is only confirmed that many bars after it happened, and the script uses it from that bar on.
  2. Average them into a centre line. The first pivot sets the centre. Each later pivot, high or low, updates it as two thirds of the old centre plus one third of the new pivot. Recent pivots count most; older ones fade but never fully leave.
  3. Draw ATR bands around the centre. Upper and lower bands sit "ATR Factor" times ATR (defaults 3 and 10) above and below the centre line, not above and below price.
  4. Trail. In an uptrend the lower band only moves up while the previous close is above it. In a downtrend the upper band only moves down while the previous close is below it. A close beyond the opposite band flips the trend and the line switches sides.
  5. Label the flip. The script prints a label it calls "Buy" when the trend turns up and "Sell" when it turns down, at the line value. Its alerts use the same two conditions plus "Trend Changed".

Why it is not a normal SuperTrend

A normal SuperTrend hangs its bands off the current price (usually the bar's midpoint). Here they hang off a slow average of swing points. That has two visible effects. The line can sit a long way from price: on our random-walk test the median gap between close and line was 3.6 ATR and one bar in ten was over 6.1 ATR. And the line moves only when a new pivot is confirmed or ATR changes, so in a fast move it can stay put while price runs.

Timing: what is known when

Pivots arrive late by design: at the default of 2, a swing high is confirmed 2 bars after it printed, and the centre line updates then, not on the swing bar. The line and flips use confirmed pivots and the bar's close, so history does not rewrite itself the way a pivot label drawn back in time does. Two things to watch:

The settings

SettingDefaultWhat it does
Pivot Point Period2bars each side for a pivot; also the confirmation delay. At 2, about one bar in four becomes a confirmed pivot on random prices
ATR Factor3band distance in ATRs. Biggest lever: on random prices a flip came every ~21 bars at 1, ~58 at 3 and ~100 at 5
ATR Period10smoothing of the ATR that sets band width
Show Pivot Pointsoffmarks each pivot, drawn 2 bars back
Show Buy/Sell Labelsonthe flip labels
Show PP Center Lineoffthe average itself, blue when below the bar's midpoint, red when above
Show Support/Resistanceoffthe latest pivot low and high as dots, drawn 2 bars back

Raising the pivot period makes the centre line slower, not smarter: on the same random data, 5 gave a flip about every 72 bars and 10 about every 90.

The alerts

Three alert conditions: "Buy Signal", "Sell Signal" and "Trend Changed". The names are the script's; they test only whether the trend flag changed. Nothing in the code checks what price does afterwards, and the page does not either.

Where it fails

Also explained: Supertrend · Chandelier Exit · UT Bot Alerts · Pivot Points High Low · Repainting

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Pivot Point SuperTrend is by LonesomeTheBlue on TradingView, published under the Mozilla Public License 2.0; this page explains its published open-source code and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the indicator trades.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Subscribe to the Teardown Letter: $19/moBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.