VWAP Zscore With Signals
length = 20 | upper_bottom = 2.5 | lower_bottom = -2.5 Overview
VWAP Z-Score With Signals computes a normalized VWAP deviation and emits companion support and resistance signal lines based on configurable upper and lower thresholds. It is useful when you want a compact VWAP mean-reversion panel rather than a broader deviation-band study.
In VectorTA the indicator works on close-plus-volume input, supports streaming updates, and exposes batch sweeps over the z-score window and threshold levels. That makes it a practical study for threshold-based VWAP reversions, support/resistance event labeling, and lightweight parameter scans.
Defaults: `length = 20`, `upper_bottom = 2.5`, and `lower_bottom = -2.5`.
Implementation Examples
Run the indicator on close-plus-volume slices or on candle data with the default thresholds.
use vector_ta::indicators::vwap_zscore_with_signals::{
vwap_zscore_with_signals,
VwapZscoreWithSignalsInput,
VwapZscoreWithSignalsParams,
};
let output = vwap_zscore_with_signals(&VwapZscoreWithSignalsInput::from_slices(
&close,
&volume,
VwapZscoreWithSignalsParams::default(),
))?;
println!("zvwap = {:?}", output.zvwap.last());
println!("support = {:?}", output.support_signal.last());API Reference
Input Methods ▼
VwapZscoreWithSignalsInput::from_candles(&Candles, VwapZscoreWithSignalsParams)
-> VwapZscoreWithSignalsInput
VwapZscoreWithSignalsInput::from_slices(&[f64], &[f64], VwapZscoreWithSignalsParams)
-> VwapZscoreWithSignalsInput
VwapZscoreWithSignalsInput::with_default_candles(&Candles)
-> VwapZscoreWithSignalsInputParameters Structure ▼
pub struct VwapZscoreWithSignalsParams {
pub length: Option<usize>,
pub upper_bottom: Option<f64>,
pub lower_bottom: Option<f64>,
}Output Structure ▼
pub struct VwapZscoreWithSignalsOutput {
pub zvwap: Vec<f64>,
pub support_signal: Vec<f64>,
pub resistance_signal: Vec<f64>,
}Validation, Warmup & NaNs ▼
- Close and volume inputs must share the same non-zero length and contain enough valid data for the resolved
length. - The threshold values control when support and resistance flags are emitted from the normalized VWAP series.
- Streaming returns
Noneuntil the z-score state is warmed up. - Batch mode validates the integer and float range axes before generating the output grid.
Builder, Streaming & Batch APIs ▼
VwapZscoreWithSignalsBuilder::new()
.length(usize)
.upper_bottom(f64)
.lower_bottom(f64)
.kernel(Kernel)
.apply(&Candles)
.apply_slices(&[f64], &[f64])
.into_stream()
VwapZscoreWithSignalsStream::try_new(params)
stream.update(close, volume) -> Option<(f64, f64, f64)>
VwapZscoreWithSignalsBatchBuilder::new()
.length_range(start, end, step)
.upper_bottom_range(start, end, step)
.lower_bottom_range(start, end, step)
.apply_slices(&[f64], &[f64])Python Bindings
Python exposes direct, stream, and batch helpers for the z-score line and its support/resistance signals.
from vector_ta import vwap_zscore_with_signals, vwap_zscore_with_signals_batch, VwapZscoreWithSignalsStream
single = vwap_zscore_with_signals(close, volume)
stream = VwapZscoreWithSignalsStream()
point = stream.update(close[-1], volume[-1])
batch = vwap_zscore_with_signals_batch(
close,
volume,
length_range=(10, 30, 10),
upper_bottom_range=(2.0, 3.0, 0.5),
lower_bottom_range=(-3.0, -2.0, 0.5),
)JavaScript/WASM Bindings
The WASM layer exposes direct, batch, allocation, and into-buffer helpers for the z-score and signal trio.
import init, { vwap_zscore_with_signals_js, vwap_zscore_with_signals_batch_js } from "vector-ta-wasm";
await init();
const single = vwap_zscore_with_signals_js(close, volume, 20, 2.5, -2.5);
const batch = vwap_zscore_with_signals_batch_js(close, volume, {
length_range: [10, 30, 10],
upper_bottom_range: [2.0, 3.0, 0.5],
lower_bottom_range: [-3.0, -2.0, 0.5],
});CUDA Bindings (Rust)
Additional details for the CUDA bindings can be found inside the VectorTA repository.
Performance Analysis
Across sizes, Rust CPU runs about 1.14× faster than Tulip C in this benchmark.
AMD Ryzen 9 9950X (CPU) | NVIDIA RTX 4090 (GPU)