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

Taught to TradeSystems over signals.

Explainers / Pivot highs and lows

Pivot Points High Low & Missed Reversal Levels by LuxAlgo, explained from the source

The most-boosted pivot script on TradingView is LuxAlgo's "Pivot Points High Low & Missed Reversal Levels". It marks swing highs and lows on the chart, joins them with a zigzag, and adds ghost markers for turning points it calls "missed". On a finished chart it looks like it caught every top and bottom. This page explains, from the published source, why it looks that way. The short version: a pivot can only be known a fixed number of bars after it happens, and the marker is then drawn back at the bar where it happened.

What a pivot high is

A pivot high is a bar whose high is higher than the highs of a set number of bars on each side. Pine Script has this built in: ta.pivothigh(left, right). A pivot low is the mirror, using lows.

The LuxAlgo script uses the same number on both sides: Pivot Length, 50 by default. So a bar is a pivot high when its high beats the 50 bars before it and is not beaten by the 50 bars after it.

Why it appears N bars late

Read that definition again: "the 50 bars after it". Nobody knows whether a high is a pivot until those 50 bars have closed. So ta.pivothigh(50, 50) returns nothing on the bar of the high, and returns the high's price 50 bars later.

The script then places the marker at the bar of the high, 50 bars back (bar_index - length in the code). On a historical chart you see a label sitting exactly on the top. Live, that label did not exist until 50 bars after the top.

This is not a bug, and the label does not move once drawn. It is the definition of a pivot. But it means the chart shows you the pivots with hindsight. With a length of 50 on a daily chart, each marker appeared about ten weeks after the date it sits on. See what repainting is for why back-dated drawings look better than they traded, or test a script with the repaint checker.

What the "missed reversal levels" are

A clean zigzag goes high, low, high, low. Sometimes two pivot highs arrive with no pivot low between them: price dipped between them, but not far enough or long enough to pass the 50-bar test.

The script keeps track of the lowest low since the last pivot. When a second pivot high arrives in a row, it puts a ghost marker on that lowest low and draws a dashed zigzag segment to it, so the zigzag still alternates. The mirror happens for two pivot lows in a row.

There is a second case. Pivots can alternate correctly and still skip a swing: if a new pivot high is lower than the highest high since the last pivot, the script puts a ghost on that higher high and another ghost on the lowest low that followed it, then joins them with dashed segments. The mirror happens for pivot lows.

So a ghost marker is a turning point that failed the pivot test and was filled in afterwards, at the moment the next pivot was confirmed. It is drawn even later than a regular pivot.

Each ghost also starts a thick, faded horizontal level. The newest one is stretched to the current bar on every bar until the next ghost replaces it.

The one marker that moves

Everything above is drawn once and stays put. The exception is on the last bar. There the script looks back to the last confirmed pivot, finds the most extreme price since then (the lowest low after a pivot high, or the highest high after a pivot low), and puts a ghost on it with a level running to the current bar. It deletes and redraws that ghost on every new bar. So while a swing is still unconfirmed, the newest ghost slides to each new extreme. Watch it live and you will see it jump; on a historical chart only its final position is left.

How often pivots happen

In a simulation on pure random-walk prices (200,000 bars, nothing to predict):

Settings, honestly

Where it fails

Also explained

Educational content only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Original script by LuxAlgo on TradingView (CC BY-NC-SA 4.0); this page explains its published source and quotes no code beyond the names of Pine built-ins.

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, 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, Pivot Point SuperTrend, 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.