Volume Weighted Stochastic RSI
rsi_length = 14 | stoch_length = 14 | k_length = 3 | d_length = 3 | ma_type = WSMA Overview
Volume Weighted Stochastic RSI takes a volume-aware RSI core and transforms it into a stochastic-style K and D pair. It is useful when you want a faster overbought-oversold oscillator that still respects differences in volume participation.
In VectorTA the indicator accepts a source-plus-volume pair or candle data, supports streaming updates, and exposes batch sweeps over the RSI, stochastic, K, and D lengths. That makes it well suited for compact tactical oscillators and grid-based parameter studies.
Defaults: `rsi_length = 14`, `stoch_length = 14`, `k_length = 3`, `d_length = 3`, and `ma_type = "WSMA"`.
Implementation Examples
Run the indicator on a direct source-plus-volume pair or on candles with the default settings.
use vector_ta::indicators::volume_weighted_stochastic_rsi::{
volume_weighted_stochastic_rsi,
VolumeWeightedStochasticRsiInput,
VolumeWeightedStochasticRsiParams,
};
let output = volume_weighted_stochastic_rsi(&VolumeWeightedStochasticRsiInput::from_slices(
&close,
&volume,
VolumeWeightedStochasticRsiParams::default(),
))?;
println!("k = {:?}", output.k.last());
println!("d = {:?}", output.d.last());API Reference
Input Methods ▼
VolumeWeightedStochasticRsiInput::from_candles(&Candles, "close", VolumeWeightedStochasticRsiParams)
-> VolumeWeightedStochasticRsiInput
VolumeWeightedStochasticRsiInput::from_slices(&[f64], &[f64], VolumeWeightedStochasticRsiParams)
-> VolumeWeightedStochasticRsiInput
VolumeWeightedStochasticRsiInput::with_default_candles(&Candles)
-> VolumeWeightedStochasticRsiInputParameters Structure ▼
pub struct VolumeWeightedStochasticRsiParams {
pub rsi_length: Option<usize>,
pub stoch_length: Option<usize>,
pub k_length: Option<usize>,
pub d_length: Option<usize>,
pub ma_type: Option<String>,
}Output Structure ▼
pub struct VolumeWeightedStochasticRsiOutput {
pub k: Vec<f64>,
pub d: Vec<f64>,
}Validation, Warmup & NaNs ▼
- The source and volume slices must share the same non-zero length and contain enough data for the RSI, stochastic, K, and D windows.
- The moving-average type used by the smoother must be one of the supported weighted variants.
- Streaming returns
Noneuntil both K and D are warmed up. - Batch mode validates all four range axes before generating the grid.
Builder, Streaming & Batch APIs ▼
VolumeWeightedStochasticRsiBuilder::new()
.rsi_length(usize)
.stoch_length(usize)
.k_length(usize)
.d_length(usize)
.kernel(Kernel)
.apply(&Candles, "close")
.apply_slices(&[f64], &[f64])
VolumeWeightedStochasticRsiStream::try_new(params)
stream.update(source, volume) -> Option<(f64, f64)>
VolumeWeightedStochasticRsiBatchBuilder::new()
.rsi_length_range(start, end, step)
.stoch_length_range(start, end, step)
.k_length_range(start, end, step)
.d_length_range(start, end, step)
.apply_slices(&[f64], &[f64])Python Bindings
Python exposes direct, stream, and batch helpers for the volume-weighted stochastic RSI pair.
from vector_ta import volume_weighted_stochastic_rsi, volume_weighted_stochastic_rsi_batch, VolumeWeightedStochasticRsiStream
single = volume_weighted_stochastic_rsi(close, volume)
stream = VolumeWeightedStochasticRsiStream()
point = stream.update(close[-1], volume[-1])
batch = volume_weighted_stochastic_rsi_batch(
close,
volume,
rsi_length_range=(10, 18, 2),
stoch_length_range=(10, 18, 2),
k_length_range=(2, 4, 1),
d_length_range=(2, 4, 1),
)JavaScript/WASM Bindings
The WASM layer exposes direct, batch, allocation, and into-buffer helpers for the K/D oscillator pair.
import init, {
volume_weighted_stochastic_rsi_js,
volume_weighted_stochastic_rsi_batch_js,
volume_weighted_stochastic_rsi_into_host,
} from "vector-ta-wasm";
await init();
const single = volume_weighted_stochastic_rsi_js(close, volume);
const batch = volume_weighted_stochastic_rsi_batch_js(close, volume, {
rsi_length_range: [10, 18, 2],
stoch_length_range: [10, 18, 2],
k_length_range: [2, 4, 1],
d_length_range: [2, 4, 1],
});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)
Related Indicators
Accumulation/Distribution
Technical analysis indicator
Accumulation/Distribution Oscillator
Technical analysis indicator
Balance of Power
Technical analysis indicator
Chaikin Flow Oscillator
Technical analysis indicator
Elder Force Index
Technical analysis indicator
Ease of Movement
Technical analysis indicator