All indicators
Trend / Price pane

Parabolic SAR Dots

Wilder's Parabolic SAR drawn as circles coloured by the side of the trend, with a larger dot on every stop-and-reverse bar.

  • SAR Dots
  • Updates every tick
  • parabolic sar
  • sar
  • wilder
  • trailing stop
  • stop and reverse
  • trend

By Spectral · v1.0.0

MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.

Parabolic SAR Dots on a Spectral chart
Spectral chart with sample market data, default settings.

Overview

The Parabolic SAR (stop and reverse) by J. Welles Wilder places one dot per bar. In an uptrend the dot sits below price and moves up every bar by a share (the acceleration factor) of the distance to the trend's highest high; in a downtrend it sits above price and moves down toward the lowest low. The factor starts small and grows with every new extreme, so the dots close in faster the longer a trend runs. When price crosses the dot, the trend reverses and the dot moves to the other side.

The dots are green below price and red above it; a larger dot marks every reversal.

How to read it

Green dots under price: uptrend, each dot a trailing stop for longs. Red dots over price: downtrend, each dot a trailing stop for shorts. A large dot is a stop-and-reverse bar, the classic signal. In sideways markets price crosses the dots often and the SAR flips back and forth, so many traders take its signals only with a trend filter such as a moving average or the ADX.

Settings and limitations

Start, Increment and Maximum are Wilder's acceleration settings (0.02, 0.02, 0.2). Smaller values trail further from price and flip less. Reversal dots switches the larger dots; the two side colours are appearance settings. The first dot appears on the second bar.

Notes

Formulas (StockCharts ChartSchool, Parabolic SAR; Wilder, New Concepts in Technical Trading Systems, 1978): rising SAR = prior SAR + prior AF x (prior EP - prior SAR), falling SAR = prior SAR - prior AF x (prior SAR - prior EP); EP is the trend's highest high (lowest low), AF starts at Start and grows by Increment with every new EP up to Maximum; the SAR never enters the range of the two previous bars. Start and reversal details follow TradingView's built-in (and Spectral's Parabolic SAR): the first trend is up when the second close is above the first; a trend reverses when the bar's range crosses the SAR, and the new SAR is the extreme of the finished trend (at least the bar's high, at most its low). On the forming bar a cross can flip the dots until the bar closes; the live window holds the two previous bars the SAR is kept outside of. On a long chart the larger reversal dots are drawn for the newest 4,000 reversals only (Spectral keeps at most 4,000 shape markers per key); the SAR dots cover every bar.

Settings

Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.

SettingTypeDefaultRange or optionsWhat it does
StartNumber0.020.001 – 1, step 0.001Acceleration factor at the start of every trend.
IncrementNumber0.020.001 – 1, step 0.001Added to the acceleration factor each time the trend makes a new extreme.
MaximumNumber0.20.001 – 1, step 0.001Largest acceleration factor.
Reversal dotsOn / offOn—Draw a larger dot on each bar where the SAR flips to the other side of price.

What it draws

Lines

  • SARcircles · solid · 2 px · primary · colored per bar from Side (2 colors)#3FB950 #F85149

Markers

  • Stop and reversecircle, small · colors from Side (2 colors)#3FB950 #F85149

Source

Save it as parabolic-sar-dots.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.

// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** Spectral keeps at most 4,000 shape markers per key: reversal markers go on the most recent ones. */
const MAX_REVERSALS = 4000;

/** @type {import('./spectral-indicator').IndicatorV3} */
export default {
  schemaVersion: 3,
  id: 'parabolic-sar-dots',
  name: 'Parabolic SAR Dots',
  shortName: 'SAR Dots',
  version: '1.0.0',
  author: 'Spectral',
  description: 'Wilder\'s Parabolic SAR drawn as circles coloured by the side of the trend, with a larger dot on every stop-and-reverse bar.',
  pane: 'price',
  live: { lookback: 2 },
  inputs: {
    start: { type: 'number', label: 'Start', default: 0.02, min: 0.001, max: 1, step: 0.001, description: 'Acceleration factor at the start of every trend.' },
    increment: { type: 'number', label: 'Increment', default: 0.02, min: 0.001, max: 1, step: 0.001, description: 'Added to the acceleration factor each time the trend makes a new extreme.' },
    maximum: { type: 'number', label: 'Maximum', default: 0.2, min: 0.001, max: 1, step: 0.001, description: 'Largest acceleration factor.' },
    showReversals: { type: 'boolean', label: 'Reversal dots', default: true, description: 'Draw a larger dot on each bar where the SAR flips to the other side of price.' },
  },
  palettes: {
    side: { label: 'Side', colors: ['#3FB950', '#F85149'] },
  },
  plots: {
    sar: { label: 'SAR', color: '#3FB950', lineWidth: 2, primary: true, style: 'circles', palette: 'side' },
  },
  markers: {
    reversals: { label: 'Stop and reverse', color: '#3FB950', shape: 'circle', size: 'small', palette: 'side', hideBelowBarWidth: 2 },
  },
  docs: {
    overview: 'The Parabolic SAR (stop and reverse) by J. Welles Wilder places one dot per bar. In an uptrend the dot sits below price and moves up every bar by a share (the acceleration factor) of the distance to the trend\'s highest high; in a downtrend it sits above price and moves down toward the lowest low. The factor starts small and grows with every new extreme, so the dots close in faster the longer a trend runs. When price crosses the dot, the trend reverses and the dot moves to the other side.\n\nThe dots are green below price and red above it; a larger dot marks every reversal.',
    howToRead: 'Green dots under price: uptrend, each dot a trailing stop for longs. Red dots over price: downtrend, each dot a trailing stop for shorts. A large dot is a stop-and-reverse bar, the classic signal. In sideways markets price crosses the dots often and the SAR flips back and forth, so many traders take its signals only with a trend filter such as a moving average or the ADX.',
    settings: 'Start, Increment and Maximum are Wilder\'s acceleration settings (0.02, 0.02, 0.2). Smaller values trail further from price and flip less. Reversal dots switches the larger dots; the two side colours are appearance settings. The first dot appears on the second bar.',
    notes: 'Formulas (StockCharts ChartSchool, Parabolic SAR; Wilder, New Concepts in Technical Trading Systems, 1978): rising SAR = prior SAR + prior AF x (prior EP - prior SAR), falling SAR = prior SAR - prior AF x (prior SAR - prior EP); EP is the trend\'s highest high (lowest low), AF starts at Start and grows by Increment with every new EP up to Maximum; the SAR never enters the range of the two previous bars. Start and reversal details follow TradingView\'s built-in (and Spectral\'s Parabolic SAR): the first trend is up when the second close is above the first; a trend reverses when the bar\'s range crosses the SAR, and the new SAR is the extreme of the finished trend (at least the bar\'s high, at most its low). On the forming bar a cross can flip the dots until the bar closes; the live window holds the two previous bars the SAR is kept outside of. On a long chart the larger reversal dots are drawn for the newest 4,000 reversals only (Spectral keeps at most 4,000 shape markers per key); the SAR dots cover every bar.',
  },
  calculate(ctx) {
    const { bars, inputs, ta } = ctx;
    const items = bars.map((bar, index) => ({ bar, previous: index > 0 ? bars[index - 1] : null, older: index > 1 ? bars[index - 2] : null }));
    // The SAR, the trend's extreme, the acceleration and the side carry from bar to bar; `flip` marks a reversal bar.
    const states = ta.scan(items, null, (state, item) => {
      const { bar, previous, older } = item;
      if (previous === null) return null;
      let below;
      let extreme;
      let sar;
      let acceleration;
      let fresh = false;
      let flip = false;
      if (state === null) {
        below = bar.close > previous.close;
        extreme = below ? bar.high : bar.low;
        sar = below ? previous.low : previous.high;
        acceleration = inputs.start;
        fresh = true;
      } else {
        ({ below, extreme, sar, acceleration } = state);
      }
      sar += acceleration * (extreme - sar);
      if (below && sar > bar.low) {
        [fresh, flip, below, sar, extreme, acceleration] = [true, true, false, Math.max(bar.high, extreme), bar.low, inputs.start];
      } else if (!below && sar < bar.high) {
        [fresh, flip, below, sar, extreme, acceleration] = [true, true, true, Math.min(bar.low, extreme), bar.high, inputs.start];
      }
      if (!fresh && below && bar.high > extreme) {
        extreme = bar.high;
        acceleration = Math.min(acceleration + inputs.increment, inputs.maximum);
      } else if (!fresh && !below && bar.low < extreme) {
        extreme = bar.low;
        acceleration = Math.min(acceleration + inputs.increment, inputs.maximum);
      }
      // The SAR never enters the range of the two previous bars (the one previous bar on the second bar).
      const before = older === null ? previous : older;
      sar = below ? Math.min(sar, previous.low, before.low) : Math.max(sar, previous.high, before.high);
      return { below, extreme, sar, acceleration, flip };
    });
    const sar = states.map((state) => (state === null ? null : state.sar));
    const side = states.map((state) => (state === null ? null : state.below ? 0 : 1));
    const reversals = [];
    if (inputs.showReversals) {
      for (let index = 0; index < states.length; index += 1) {
        if (states[index] !== null && states[index].flip) reversals.push({ index, value: states[index].sar, palette: side[index] });
      }
    }
    return { plots: { sar }, colors: { sar: side }, markers: { reversals: reversals.slice(-MAX_REVERSALS) } };
  },
};

Adapt it with an LLM

Paste this into your assistant and replace the second-to-last line with the change you want.

Start from this Spectral custom indicator: https://spectral.trade/indicators/parabolic-sar-dots.js
Format reference: https://spectral.trade/docs/custom-indicators.llm.md
Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match.
Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow.
Change I want: <describe the change>
Answer with the complete file in one code block, ready to save as <id>.js.