All indicators
Levels & sessions / Price pane

Pivot Points Fibonacci & Camarilla

Daily Fibonacci or Camarilla pivot levels from the previous regular session, named with their prices at the right edge, with the bars that close between S1 and R1 shaded.

  • Fib/Cam
  • Updates every tick
  • pivot points
  • fibonacci
  • camarilla
  • support
  • resistance
  • daily
  • labels

By Spectral · v1.0.0

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

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

Overview

Daily pivot levels from the previous regular session's high, low and close, in one of two classic sets. Fibonacci places R1 to R3 and S1 to S3 at 38.2, 61.8 and 100 percent of the previous range around the standard pivot. Camarilla (Nick Stott) clusters R1 to R4 and S1 to S4 around the previous close, at 1.1 times the range divided by 12, 6, 4 and 2. The levels start at the current New York trading day and are named with their prices at the right edge; bars that close between S1 and R1 of their own day are shaded.

How to read it

Fibonacci: P is the balance point of the previous session; R1 and S1 are the first reaction areas, R2 and S2 (61.8 percent) the stronger ones, R3 and S3 a full previous range away. Camarilla: price that opens between S3 and R3 tends to stay in range, so traders fade moves to R3 and S3; a close beyond R4 or S4 suggests a breakout day. The shading shows how much of the session stays balanced between S1 and R1. Levels are reference prices, not signals.

Settings and limitations

Type chooses the set. R4 and S4 only draw for Camarilla: in Fibonacci mode their colour and line settings stay in the settings but have nothing to draw. Prices in labels adds each level's price to its name. Shade inside S1-R1 turns the shading off; its colour and opacity are appearance settings.

The previous session's high, low and close come from daily regular-trading-hours bars that Spectral loads beside the chart (the last month), so the levels are the same on every intraday bar size, and the shading reaches back as far as that month. Weekly and monthly charts show nothing.

Notes

Formulas (StockCharts ChartSchool Fibonacci pivots; TradingView Pivot Points Standard, Camarilla): P = (H + L + C) / 3; Fibonacci R1/S1 = P ± 0.382(H - L), R2/S2 = P ± 0.618(H - L), R3/S3 = P ± (H - L); Camarilla R1/S1 = C ± 1.1(H - L)/12, R2/S2 = C ± 1.1(H - L)/6, R3/S3 = C ± 1.1(H - L)/4, R4/S4 = C ± 1.1(H - L)/2, with H, L and C the previous regular session's high, low and close. Camarilla's P is the standard pivot, as on TradingView. A bar's shading uses its own day's S1 and R1. For Standard and Woodie pivots or other periods use Pivot Points Standard (Labeled) or the built-in Pivot Points.

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
TypeChoiceFibonacciFibonacci, CamarillaFibonacci: levels at 38.2, 61.8 and 100 percent of the previous range around the pivot. Camarilla: four levels each side of the previous close at 1.1 times the range divided by 12, 6, 4 and 2.
Prices in labelsOn / offOn—Write each level's price next to its name.
Shade inside S1-R1On / offOn—Shade the bars that close between S1 and R1 of their own day.

What it draws

Levels

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

Text labels

  • Level namesbox label · left · colors from Level colors (3 colors)#C4A46A #D0837A #7FB5A0

Background shadings

  • Inside S1-R1background per bar from Inside S1-R1 (1 colors) · at 8% opacity#8B949E

Source

Save it as pivot-points-fib-camarilla.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').IndicatorV3} */
export default {
  schemaVersion: 3,
  id: 'pivot-points-fib-camarilla',
  name: 'Pivot Points Fibonacci & Camarilla',
  shortName: 'Fib/Cam',
  version: '1.0.0',
  author: 'Spectral',
  description: 'Daily Fibonacci or Camarilla pivot levels from the previous regular session, named with their prices at the right edge, with the bars that close between S1 and R1 shaded.',
  pane: 'price',
  live: { lookback: 0 },
  inputs: {
    type: { type: 'select', label: 'Type', default: 'Fibonacci', options: ['Fibonacci', 'Camarilla'], description: 'Fibonacci: levels at 38.2, 61.8 and 100 percent of the previous range around the pivot. Camarilla: four levels each side of the previous close at 1.1 times the range divided by 12, 6, 4 and 2.' },
    showPrice: { type: 'boolean', label: 'Prices in labels', default: true, description: 'Write each level\'s price next to its name.' },
    shadeInside: { type: 'boolean', label: 'Shade inside S1-R1', default: true, description: 'Shade the bars that close between S1 and R1 of their own day.' },
  },
  palettes: {
    side: { label: 'Level colors', colors: ['#C4A46A', '#D0837A', '#7FB5A0'] },
    inside: { label: 'Inside S1-R1', colors: ['#8B949E'] },
  },
  levels: {
    pivot: { label: 'P', color: '#C4A46A', lineWidth: 1.5, lineStyle: 'solid' },
    r1: { label: 'R1', color: '#D0837A', lineStyle: 'solid' },
    r2: { label: 'R2', color: '#D0837A', lineStyle: 'dashed' },
    r3: { label: 'R3', color: '#D0837A', lineStyle: 'dotted' },
    r4: { label: 'R4', color: '#D0837A', lineStyle: 'dotted' },
    s1: { label: 'S1', color: '#7FB5A0', lineStyle: 'solid' },
    s2: { label: 'S2', color: '#7FB5A0', lineStyle: 'dashed' },
    s3: { label: 'S3', color: '#7FB5A0', lineStyle: 'dotted' },
    s4: { label: 'S4', color: '#7FB5A0', lineStyle: 'dotted' },
  },
  labels: {
    names: { label: 'Level names', color: '#C4A46A', palette: 'side', style: 'box', placement: 'left', textSize: 'small' },
  },
  bgColors: {
    balance: { label: 'Inside S1-R1', palette: 'inside', opacity: 0.08 },
  },
  auxiliary: {
    daily: { barSize: '1 day', duration: '1 M', useRth: true, keepUpToDate: true },
  },
  docs: {
    overview: 'Daily pivot levels from the previous regular session\'s high, low and close, in one of two classic sets. Fibonacci places R1 to R3 and S1 to S3 at 38.2, 61.8 and 100 percent of the previous range around the standard pivot. Camarilla (Nick Stott) clusters R1 to R4 and S1 to S4 around the previous close, at 1.1 times the range divided by 12, 6, 4 and 2. The levels start at the current New York trading day and are named with their prices at the right edge; bars that close between S1 and R1 of their own day are shaded.',
    howToRead: 'Fibonacci: P is the balance point of the previous session; R1 and S1 are the first reaction areas, R2 and S2 (61.8 percent) the stronger ones, R3 and S3 a full previous range away. Camarilla: price that opens between S3 and R3 tends to stay in range, so traders fade moves to R3 and S3; a close beyond R4 or S4 suggests a breakout day. The shading shows how much of the session stays balanced between S1 and R1. Levels are reference prices, not signals.',
    settings: 'Type chooses the set. R4 and S4 only draw for Camarilla: in Fibonacci mode their colour and line settings stay in the settings but have nothing to draw. Prices in labels adds each level\'s price to its name. Shade inside S1-R1 turns the shading off; its colour and opacity are appearance settings.\n\nThe previous session\'s high, low and close come from daily regular-trading-hours bars that Spectral loads beside the chart (the last month), so the levels are the same on every intraday bar size, and the shading reaches back as far as that month. Weekly and monthly charts show nothing.',
    notes: 'Formulas (StockCharts ChartSchool Fibonacci pivots; TradingView Pivot Points Standard, Camarilla): P = (H + L + C) / 3; Fibonacci R1/S1 = P ± 0.382(H - L), R2/S2 = P ± 0.618(H - L), R3/S3 = P ± (H - L); Camarilla R1/S1 = C ± 1.1(H - L)/12, R2/S2 = C ± 1.1(H - L)/6, R3/S3 = C ± 1.1(H - L)/4, R4/S4 = C ± 1.1(H - L)/2, with H, L and C the previous regular session\'s high, low and close. Camarilla\'s P is the standard pivot, as on TradingView. A bar\'s shading uses its own day\'s S1 and R1. For Standard and Woodie pivots or other periods use Pivot Points Standard (Labeled) or the built-in Pivot Points.',
  },
  calculate(ctx) {
    const { bars, inputs, time, auxiliary, barSize, format } = ctx;
    const keys = ['r4', 'r3', 'r2', 'r1', 'pivot', 's1', 's2', 's3', 's4'];
    const empty = Object.fromEntries(keys.map((key) => [key, null]));
    const none = () => bars.map(() => null);
    const last = bars.length - 1;
    if (last < 0 || barSize === '1 week' || barSize === '1 month') return { levels: empty, labels: { names: [] }, bgColors: { balance: none() } };

    const camarilla = inputs.type === 'Camarilla';
    const levelsOf = ({ high, low, close }) => {
      const pivot = (high + low + close) / 3;
      const range = high - low;
      if (camarilla) {
        const step = 1.1 * range;
        return {
          pivot,
          r1: close + step / 12, r2: close + step / 6, r3: close + step / 4, r4: close + step / 2,
          s1: close - step / 12, s2: close - step / 6, s3: close - step / 4, s4: close - step / 2,
        };
      }
      return {
        pivot,
        r1: pivot + 0.382 * range, r2: pivot + 0.618 * range, r3: pivot + range, r4: null,
        s1: pivot - 0.382 * range, s2: pivot - 0.618 * range, s3: pivot - range, s4: null,
      };
    };
    // Daily bars by New York date, oldest first; a chart bar's levels come from the last one before its date.
    const daily = auxiliary.daily.map((bar) => ({ date: time.ny(bar).dateKey, bar }));
    const previousBefore = (date) => {
      for (let index = daily.length - 1; index >= 0; index -= 1) if (daily[index].date < date) return daily[index].bar;
      return null;
    };

    // Shading: each bar against its own day's S1 and R1, looked up once per date.
    const balance = none();
    if (inputs.shadeInside) {
      let date = null;
      let day = null;
      for (let index = 0; index <= last; index += 1) {
        const barDate = time.ny(bars[index]).dateKey;
        if (barDate !== date) {
          date = barDate;
          const previous = previousBefore(barDate);
          day = previous === null ? null : levelsOf(previous);
        }
        if (day !== null && bars[index].close >= day.s1 && bars[index].close <= day.r1) balance[index] = 0;
      }
    }

    const previous = previousBefore(time.ny(bars[last]).dateKey);
    if (previous === null) return { levels: empty, labels: { names: [] }, bgColors: { balance } };
    const values = levelsOf(previous);
    const fromTime = time.dayStart(bars[last]);
    const levels = {};
    const names = [];
    for (const key of keys) {
      const value = values[key];
      levels[key] = value === null ? null : { price: value, fromTime };
      if (value === null) continue;
      const name = key === 'pivot' ? 'P' : key.toUpperCase();
      names.push({
        index: 'right-edge',
        value,
        text: inputs.showPrice ? `${name} ${format.price(value)}` : name,
        palette: key === 'pivot' ? 0 : key.startsWith('r') ? 1 : 2,
      });
    }
    return { levels, labels: { names }, bgColors: { balance } };
  },
};

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-fib-camarilla.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.