Pivot Points (PIVOT)

Parameters: mode = 3

Overview

Pivot Points calculate a central reference level and surrounding support resistance bands from the previous period's high, low, and close prices, providing floor traders and technical analysts with objective levels where price action may pause or reverse. The standard formula averages the high, low, and close to establish the pivot point, then generates support levels below and resistance levels above using arithmetic progressions based on the range. Different calculation methods like Fibonacci apply specific ratios to adjust the spacing between levels, Demark focuses on the relationship between close and open to calculate conditional pivots, Camarilla emphasizes tighter bands with a multiplier approach for intraday trading, and Woodie gives extra weight to the current close. Traders use these levels as decision points for entries, exits, and stop placement, with price holding above the pivot typically indicating bullish conditions and falling below suggesting bearish pressure. The multiple support and resistance bands provide layered targets for profit taking and zones to watch for reversals, making pivot points especially popular among day traders who need predefined reference levels before the market opens.

Defaults: Camarilla mode (mode = 3). Other modes available: Standard (0), Fibonacci (1), Demark (2), Woodie (4).

Implementation Examples

use vector_ta::indicators::pivot::{pivot, PivotInput, PivotParams};
use vector_ta::utilities::data_loader::read_candles_from_csv;
let (high, low, close, open) = (vec![], vec![], vec![], vec![]);
let input = PivotInput::from_slices(&high, &low, &close, &open, PivotParams { mode: Some(3) });
let out = pivot(&input)?;

API Reference

Input Methods
PivotInput::from_slices(&[f64], &[f64], &[f64], &[f64], PivotParams)
PivotInput::from_candles(&Candles, PivotParams)
PivotInput::with_default_candles(&Candles)
Parameters Structure
pub struct PivotParams { pub mode: Option<usize> } // Default: Some(3)
Output Structure
pub struct PivotOutput { r4: Vec<f64>, r3: Vec<f64>, r2: Vec<f64>, r1: Vec<f64>, pp: Vec<f64>, s1: Vec<f64>, s2: Vec<f64>, s3: Vec<f64>, s4: Vec<f64> }
Validation, Warmup & NaNs
  • Lengths must match; empty input or mismatched lengths yield PivotError::EmptyData.
  • Warmup NaNs through the first index where H/L/C are valid; per-index NaNs propagate.
  • AllValuesNaN when no valid H/L/C; NotEnoughValidData when first valid index ≥ len.
Error Handling
enum PivotError { EmptyData, AllValuesNaN, NotEnoughValidData }

Python Bindings

Quick Start
import numpy as np
from vector_ta import pivot, PivotStream, pivot_batch

high = np.array([/* ... */], dtype=np.float64)
low  = np.array([/* ... */], dtype=np.float64)
close= np.array([/* ... */], dtype=np.float64)
open_ = np.array([/* ... */], dtype=np.float64)

# One-shot
result = pivot(high, low, close, open_, mode=3)  # tuple of 9 arrays

# Streaming
stream = PivotStream(mode=3)
levels = stream.update(h, l, c, o)  # (r4,r3,r2,r1,pp,s1,s2,s3,s4) or None

# Batch sweep across modes
res = pivot_batch(high, low, close, open_, mode_range=(0, 4, 1), kernel='auto')
# res contains keys: 'r4','r3','r2','r1','pp','s1','s2','s3','s4', with shape (num_modes, len)

CUDA Acceleration

CUDA helpers are available when the Python package is built with CUDA support. Inputs must be float32; outputs are device arrays (DLPack / __cuda_array_interface__ compatible).

import numpy as np
  from vector_ta import pivot_cuda_batch_dev, pivot_cuda_many_series_one_param_dev

  # One series (float32)
  high_f32 = np.asarray(load_high(), dtype=np.float32)
  low_f32 = np.asarray(load_low(), dtype=np.float32)
  close_f32 = np.asarray(load_close(), dtype=np.float32)
  open_f32 = np.asarray(load_open(), dtype=np.float32)

  dev = pivot_cuda_batch_dev(
      high_f32=high_f32,
      low_f32=low_f32,
      close_f32=close_f32,
      open_f32=open_f32,
      mode_range=(0, 4, 1),
      device_id=0,
  )

  # Many series (time-major)
  high_tm_f32 = np.asarray(load_high_time_major_matrix(), dtype=np.float32)
  rows, cols = high_tm_f32.shape
  high_tm_f32 = high_tm_f32.ravel()
  low_tm_f32 = np.asarray(load_low_time_major_matrix(), dtype=np.float32)
  low_tm_f32 = low_tm_f32.ravel()
  close_tm_f32 = np.asarray(load_close_time_major_matrix(), dtype=np.float32)
  close_tm_f32 = close_tm_f32.ravel()
  open_tm_f32 = np.asarray(load_open_time_major_matrix(), dtype=np.float32)
  open_tm_f32 = open_tm_f32.ravel()

  dev_tm = pivot_cuda_many_series_one_param_dev(
      high_tm_f32=high_tm_f32,
      low_tm_f32=low_tm_f32,
      close_tm_f32=close_tm_f32,
      open_tm_f32=open_tm_f32,
      cols=cols,
      rows=rows,
      mode=14,
      device_id=0,
  )

JavaScript/WASM Bindings

Available: pivot_js, pivot_into, pivot_alloc/free, and pivot_batch (WASM).

CUDA Bindings (Rust)

use vector_ta::cuda::CudaPivot;
use vector_ta::indicators::pivot::PivotBatchRange;

let cuda = CudaPivot::new(0)?;

let high: [f32] = /* ... */;
let low: [f32] = /* ... */;
let close: [f32] = /* ... */;
let open: [f32] = /* ... */;
let sweep = PivotBatchRange::default();

let out = cuda.pivot_batch_dev(&high, &low, &close, &open, &sweep)?;
let _ = out;

Performance Analysis

Comparison:
View:
Loading chart...

AMD Ryzen 9 9950X (CPU) | NVIDIA RTX 4090 (GPU) | Benchmarks: 2026-01-08

Related Indicators