All indicators
Levels & sessions / Price pane

Pivot Points

Traditional, Fibonacci, Camarilla or Woodie pivot point, resistance and support levels from the previous day, week, month or year.

  • Pivots
  • Built into Spectral
  • Updates every tick
  • pivot points
  • floor pivots
  • fibonacci pivots
  • camarilla
  • woodie
  • support resistance
  • higher timeframe

By Spectral · v1.0.0

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

Already in Spectral: add it from the Indicators toolbox. The file here is the same indicator written as a custom indicator, to change or learn from. Installed, it appears next to the built-in one, marked Custom.

Pivot Points on a Spectral chart
Spectral chart with sample market data, default settings.

Overview

Pivot Points turn the previous period's high, low and close into a central pivot (P) with resistance levels above it (R1, R2, R3) and support levels below it (S1, S2, S3), drawn from the start of the current period. Traditional sets P to the average of high, low and close and steps out by the range; Fibonacci places the levels at 38.2, 61.8 and 100 percent of the range around P; Camarilla clusters four levels each side close to the previous close (1.1 times the range divided by 12, 6, 4 and 2); Woodie weights the current period's open twice.

The high, low and close come from real daily, weekly and monthly regular-trading-hours bars that Spectral loads beside the chart, so the levels are correct on any bar size and history length.

How to read it

P is the balance point of the previous period: trading above it leans bullish for the current period, below it bearish. R1 and S1 are the first areas where intraday moves often pause or turn; R2 and S2 are reached on stronger days, and R3 and S3 mark an unusually wide range.

Camarilla traders watch R3 and S3 for fades back into the range and R4 and S4 for breakouts. Pivots are reference prices, not signals: look for a reaction, acceptance or rejection at a level before acting on it.

Settings and limitations

Type chooses the formula. Period chooses the period the levels come from; Auto uses daily pivots up to 15-minute bars, weekly pivots above 15 minutes, monthly pivots on daily bars and yearly pivots on weekly or monthly bars, like most charting platforms. Pivot, Resistance and Support switch each group of levels.

The current period is the one the chart's last bar belongs to (New York trading date, Monday-to-Friday week, calendar month or year), and the levels start at its first chart bar. Values use regular trading hours, so the close is the 16:00 close (13:00 on early-close days). Woodie needs the current period's regular-session open and stays hidden before it, for example in the pre-market.

Notes

Formulas as in TradingView's Pivot Points Standard, which uses the current period's open for Woodie and the average of high, low and close as the Camarilla pivot. This indicator draws R1 to R3 and S1 to S3 for Traditional, Fibonacci and Woodie and R1 to R4 and S1 to S4 for Camarilla; TradingView also offers higher levels and pivots of earlier periods. The yearly levels are built from monthly bars of the previous calendar year. A fixed period loads only the bars it needs: daily bars for Daily, weekly bars for Weekly, monthly bars for Monthly and Yearly. Auto loads all three, because the one it uses depends on the chart's bar size, which cannot switch a series on or off; they are short (one month of daily bars, three months of weekly bars, two years of monthly bars).

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
TypeChoiceTraditionalTraditional, Fibonacci, Camarilla, WoodieThe pivot formula. Camarilla adds a fourth resistance and support level.
PeriodChoiceAutoAuto, Daily, Weekly, Monthly, YearlyThe period whose high, low and close the levels come from. Auto: daily up to 15-minute bars, weekly above that, monthly on daily bars, yearly on weekly and monthly bars.
PivotOn / offOn—Draw the central pivot point (P).
ResistanceOn / offOn—Draw the resistance levels above the pivot (R1 to R3, R4 for Camarilla).
SupportOn / offOn—Draw the support levels below the pivot (S1 to S3, S4 for Camarilla).

Presets

Each preset is its own entry in the Indicators toolbox, with these settings changed.

Toolbox entryShort nameSettings
Pivot Points (Fibonacci)Fib PivotsType: Fibonacci
Pivot Points (Camarilla)CamarillaType: Camarilla
Pivot Points (Woodie)WoodieType: Woodie
Pivot Points (weekly)W PivotsPeriod: Weekly
Pivot Points (monthly)M PivotsPeriod: Monthly

What it draws

Levels

  • Psolid · 1.5 px · value on the axis#C4A46A
  • R1solid · 1 px · value on the axis#D0837A
  • R2dashed · 1 px · value on the axis#D0837A
  • R3dotted · 1 px · value on the axis#D0837A
  • R4dotted · 1 px · value on the axis#D0837A
  • S1solid · 1 px · value on the axis#7FB5A0
  • S2dashed · 1 px · value on the axis#7FB5A0
  • S3dotted · 1 px · value on the axis#7FB5A0
  • S4dotted · 1 px · value on the axis#7FB5A0

Source

Save it as pivot-points.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
/** @type {import('./spectral-indicator').IndicatorV2} */
export default {
  schemaVersion: 2,
  id: 'pivot-points',
  name: 'Pivot Points',
  shortName: 'Pivots',
  version: '1.0.0',
  author: 'Spectral',
  description: 'Traditional, Fibonacci, Camarilla or Woodie pivot point, resistance and support levels from the previous day, week, month or year.',
  pane: 'price',
  live: { lookback: 0 },
  inputs: {
    type: { type: 'select', label: 'Type', default: 'Traditional', options: ['Traditional', 'Fibonacci', 'Camarilla', 'Woodie'], description: 'The pivot formula. Camarilla adds a fourth resistance and support level.' },
    period: { type: 'select', label: 'Period', default: 'Auto', options: ['Auto', 'Daily', 'Weekly', 'Monthly', 'Yearly'], description: 'The period whose high, low and close the levels come from. Auto: daily up to 15-minute bars, weekly above that, monthly on daily bars, yearly on weekly and monthly bars.' },
    showPivot: { type: 'boolean', label: 'Pivot', default: true, description: 'Draw the central pivot point (P).' },
    showResistance: { type: 'boolean', label: 'Resistance', default: true, description: 'Draw the resistance levels above the pivot (R1 to R3, R4 for Camarilla).' },
    showSupport: { type: 'boolean', label: 'Support', default: true, description: 'Draw the support levels below the pivot (S1 to S3, S4 for Camarilla).' },
  },
  levels: {
    pivot: { label: 'P', color: '#C4A46A', lineWidth: 1.5, lineStyle: 'solid', showValue: true },
    r1: { label: 'R1', color: '#D0837A', lineStyle: 'solid', showValue: true },
    r2: { label: 'R2', color: '#D0837A', lineStyle: 'dashed', showValue: true },
    r3: { label: 'R3', color: '#D0837A', lineStyle: 'dotted', showValue: true },
    r4: { label: 'R4', color: '#D0837A', lineStyle: 'dotted', showValue: true },
    s1: { label: 'S1', color: '#7FB5A0', lineStyle: 'solid', showValue: true },
    s2: { label: 'S2', color: '#7FB5A0', lineStyle: 'dashed', showValue: true },
    s3: { label: 'S3', color: '#7FB5A0', lineStyle: 'dotted', showValue: true },
    s4: { label: 'S4', color: '#7FB5A0', lineStyle: 'dotted', showValue: true },
  },
  auxiliary: {
    daily: { barSize: '1 day', duration: '1 M', useRth: true, keepUpToDate: true, when: { all: [{ input: 'period', in: ['Auto', 'Daily'] }] } },
    weekly: { barSize: '1 week', duration: '3 M', useRth: true, keepUpToDate: true, when: { all: [{ input: 'period', in: ['Auto', 'Weekly'] }] } },
    monthly: { barSize: '1 month', duration: '2 Y', useRth: true, keepUpToDate: true, when: { all: [{ input: 'period', in: ['Auto', 'Monthly', 'Yearly'] }] } },
  },
  presets: [
    { id: 'fibonacci', name: 'Pivot Points (Fibonacci)', shortName: 'Fib Pivots', inputs: { type: 'Fibonacci' } },
    { id: 'camarilla', name: 'Pivot Points (Camarilla)', shortName: 'Camarilla', inputs: { type: 'Camarilla' } },
    { id: 'woodie', name: 'Pivot Points (Woodie)', shortName: 'Woodie', inputs: { type: 'Woodie' } },
    { id: 'weekly', name: 'Pivot Points (weekly)', shortName: 'W Pivots', inputs: { period: 'Weekly' } },
    { id: 'monthly', name: 'Pivot Points (monthly)', shortName: 'M Pivots', inputs: { period: 'Monthly' } },
  ],
  docs: {
    overview: 'Pivot Points turn the previous period\'s high, low and close into a central pivot (P) with resistance levels above it (R1, R2, R3) and support levels below it (S1, S2, S3), drawn from the start of the current period. Traditional sets P to the average of high, low and close and steps out by the range; Fibonacci places the levels at 38.2, 61.8 and 100 percent of the range around P; Camarilla clusters four levels each side close to the previous close (1.1 times the range divided by 12, 6, 4 and 2); Woodie weights the current period\'s open twice.\n\nThe high, low and close come from real daily, weekly and monthly regular-trading-hours bars that Spectral loads beside the chart, so the levels are correct on any bar size and history length.',
    howToRead: 'P is the balance point of the previous period: trading above it leans bullish for the current period, below it bearish. R1 and S1 are the first areas where intraday moves often pause or turn; R2 and S2 are reached on stronger days, and R3 and S3 mark an unusually wide range.\n\nCamarilla traders watch R3 and S3 for fades back into the range and R4 and S4 for breakouts. Pivots are reference prices, not signals: look for a reaction, acceptance or rejection at a level before acting on it.',
    settings: 'Type chooses the formula. Period chooses the period the levels come from; Auto uses daily pivots up to 15-minute bars, weekly pivots above 15 minutes, monthly pivots on daily bars and yearly pivots on weekly or monthly bars, like most charting platforms. Pivot, Resistance and Support switch each group of levels.\n\nThe current period is the one the chart\'s last bar belongs to (New York trading date, Monday-to-Friday week, calendar month or year), and the levels start at its first chart bar. Values use regular trading hours, so the close is the 16:00 close (13:00 on early-close days). Woodie needs the current period\'s regular-session open and stays hidden before it, for example in the pre-market.',
    notes: 'Formulas as in TradingView\'s Pivot Points Standard, which uses the current period\'s open for Woodie and the average of high, low and close as the Camarilla pivot. This indicator draws R1 to R3 and S1 to S3 for Traditional, Fibonacci and Woodie and R1 to R4 and S1 to S4 for Camarilla; TradingView also offers higher levels and pivots of earlier periods. The yearly levels are built from monthly bars of the previous calendar year. A fixed period loads only the bars it needs: daily bars for Daily, weekly bars for Weekly, monthly bars for Monthly and Yearly. Auto loads all three, because the one it uses depends on the chart\'s bar size, which cannot switch a series on or off; they are short (one month of daily bars, three months of weekly bars, two years of monthly bars).',
  },
  calculate(ctx) {
    const { bars, inputs, time, auxiliary, barSize } = ctx;
    const levels = { pivot: null, r1: null, r2: null, r3: null, r4: null, s1: null, s2: null, s3: null, s4: null };
    const lastIndex = bars.length - 1;
    if (lastIndex < 0) return { levels };

    const period = inputs.period === 'Auto' ? autoPeriod(barSize) : inputs.period;
    const keyOfDate = (dateKey) => {
      if (period === 'Monthly') return dateKey.slice(0, 7);
      if (period === 'Yearly') return dateKey.slice(0, 4);
      return dateKey;
    };
    const keyOfBar = (bar) => {
      const info = time.ny(bar);
      return period === 'Weekly' ? info.weekKey : keyOfDate(info.dateKey);
    };
    const current = keyOfBar(bars[lastIndex]);
    // The levels start at the first chart bar of the current period.
    const periodStart = periodStartTime(time, bars[lastIndex], period);

    let series = auxiliary.daily;
    if (period === 'Weekly') series = auxiliary.weekly;
    if (period === 'Monthly' || period === 'Yearly') series = auxiliary.monthly;
    const range = periodRange(series, keyOfBar, current);
    if (!range) return { levels };

    const { high, low, close: lastClose, currentOpen } = range;
    const spread = high - low;
    let values = null;
    if (inputs.type === 'Fibonacci') {
      const pivot = (high + low + lastClose) / 3;
      values = {
        pivot,
        r1: pivot + 0.382 * spread, r2: pivot + 0.618 * spread, r3: pivot + spread,
        s1: pivot - 0.382 * spread, s2: pivot - 0.618 * spread, s3: pivot - spread,
      };
    } else if (inputs.type === 'Camarilla') {
      const step = 1.1 * spread;
      values = {
        pivot: (high + low + lastClose) / 3,
        r1: lastClose + step / 12, r2: lastClose + step / 6, r3: lastClose + step / 4, r4: lastClose + step / 2,
        s1: lastClose - step / 12, s2: lastClose - step / 6, s3: lastClose - step / 4, s4: lastClose - step / 2,
      };
    } else if (inputs.type === 'Woodie') {
      if (currentOpen === null) return { levels };
      const pivot = (high + low + 2 * currentOpen) / 4;
      values = {
        pivot,
        r1: 2 * pivot - low, r2: pivot + spread, r3: high + 2 * (pivot - low),
        s1: 2 * pivot - high, s2: pivot - spread, s3: low - 2 * (high - pivot),
      };
    } else {
      const pivot = (high + low + lastClose) / 3;
      values = {
        pivot,
        r1: 2 * pivot - low, r2: pivot + spread, r3: high + 2 * (pivot - low),
        s1: 2 * pivot - high, s2: pivot - spread, s3: low - 2 * (high - pivot),
      };
    }

    const at = (price) => (typeof price === 'number' && Number.isFinite(price) ? { price, fromTime: periodStart } : null);
    if (inputs.showPivot) levels.pivot = at(values.pivot);
    for (const step of [1, 2, 3, 4]) {
      if (inputs.showResistance) levels[`r${step}`] = at(values[`r${step}`]);
      if (inputs.showSupport) levels[`s${step}`] = at(values[`s${step}`]);
    }
    return { levels };
  },
};

/** The period Auto picks for a chart bar size: daily up to 15 minutes, weekly intraday above, monthly on days, yearly above. */
function autoPeriod(barSize) {
  if (barSize === '1 day') return 'Monthly';
  if (barSize === '1 week' || barSize === '1 month') return 'Yearly';
  const match = /^(\d+) (secs|min|mins|hour|hours)$/.exec(barSize);
  if (!match) return 'Daily';
  const seconds = Number(match[1]) * (match[2] === 'secs' ? 1 : match[2].startsWith('min') ? 60 : 3600);
  return seconds <= 15 * 60 ? 'Daily' : 'Weekly';
}

const DAYS_BEFORE_MONTH = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];

/**
 * New York midnight that starts the period of `bar`: its day, its week (Monday), the 1st of its month or January
 * 1st of its year. Months and years step back whole days from the bar's day and land near noon of the first day,
 * an hour off at most across a daylight saving change, so its day start is exact.
 */
function periodStartTime(time, bar, period) {
  if (period === 'Weekly') return time.weekStart(bar);
  const dayStart = time.dayStart(bar);
  if (period !== 'Monthly' && period !== 'Yearly') return dayStart;
  const dateKey = time.ny(bar).dateKey;
  const year = Number(dateKey.slice(0, 4));
  const month = Number(dateKey.slice(5, 7));
  const day = Number(dateKey.slice(8, 10));
  let daysBack = day - 1;
  if (period === 'Yearly') {
    const leap = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
    daysBack += DAYS_BEFORE_MONTH[month - 1] + (leap && month > 2 ? 1 : 0);
  }
  return time.dayStart({ ...bar, time: dayStart - daysBack * 86400 + 12 * 3600 });
}

/**
 * High, low and close of the last period before `current`, and the open of the current period, from bars
 * keyed by period (oldest first). Several bars of one period (monthly bars of a year) are combined.
 */
function periodRange(series, keyOf, current) {
  let currentOpen = null;
  let previousKey = null;
  let high = -Infinity;
  let low = Infinity;
  let lastClose = null;
  for (let index = series.length - 1; index >= 0; index -= 1) {
    const bar = series[index];
    const key = keyOf(bar);
    if (key > current) continue;
    if (key === current) {
      currentOpen = bar.open;
      continue;
    }
    if (previousKey === null) {
      previousKey = key;
      lastClose = bar.close;
    }
    if (key !== previousKey) break;
    high = Math.max(high, bar.high);
    low = Math.min(low, bar.low);
  }
  if (previousKey === null) return null;
  return { high, low, close: lastClose, currentOpen };
}

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/pivot-points.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.