Volume Weighted Relative Strength Index

Parameters: rsi_length = 14 | range_length = 10 | ma_length = 14 | ma_type = EMA

Overview

Volume Weighted Relative Strength Index expands a standard RSI-style study into a multi-output panel with consolidation strength, a moving-average companion, and bullish and bearish trigger-price levels. It is useful when you want one volume-aware momentum block rather than a plain RSI line.

In VectorTA the indicator works on a source series plus volume, supports candles with an explicit source field, streams one point at a time, and exposes a batch range object for the three numeric controls. That makes it suitable for both chart studies and structured signal pipelines built on RSI state and volume context.

Defaults: `source = "close"`, `rsi_length = 14`, `range_length = 10`, `ma_length = 14`, and `ma_type = "EMA"`.

Implementation Examples

Run the indicator on a direct source-plus-volume pair or on candles with the default close source.

use vector_ta::indicators::volume_weighted_relative_strength_index::{
    volume_weighted_relative_strength_index,
    VolumeWeightedRelativeStrengthIndexInput,
    VolumeWeightedRelativeStrengthIndexParams,
};

let output = volume_weighted_relative_strength_index(
    &VolumeWeightedRelativeStrengthIndexInput::from_slices(
        &close,
        &volume,
        VolumeWeightedRelativeStrengthIndexParams::default(),
    ),
)?;

println!("rsi = {:?}", output.rsi.last());
println!("rsi_ma = {:?}", output.rsi_ma.last());

API Reference

Input Methods
VolumeWeightedRelativeStrengthIndexInput::from_candles(&Candles, "close", VolumeWeightedRelativeStrengthIndexParams)
    -> VolumeWeightedRelativeStrengthIndexInput

VolumeWeightedRelativeStrengthIndexInput::from_slices(&[f64], &[f64], VolumeWeightedRelativeStrengthIndexParams)
    -> VolumeWeightedRelativeStrengthIndexInput

VolumeWeightedRelativeStrengthIndexInput::with_default_candles(&Candles)
    -> VolumeWeightedRelativeStrengthIndexInput
Parameters Structure
pub struct VolumeWeightedRelativeStrengthIndexParams {
    pub rsi_length: Option<usize>,
    pub range_length: Option<usize>,
    pub ma_length: Option<usize>,
    pub ma_type: Option<String>,
}
Output Structure
pub struct VolumeWeightedRelativeStrengthIndexOutput {
    pub rsi: Vec<f64>,
    pub consolidation_strength: Vec<f64>,
    pub rsi_ma: Vec<f64>,
    pub bearish_tp: Vec<f64>,
    pub bullish_tp: Vec<f64>,
}
Validation, Warmup & NaNs
  • The source and volume slices must share the same non-zero length and contain enough valid data for the RSI, range, and MA windows.
  • The moving-average type must be one of the supported Rust implementations such as EMA, SMA, HMA, RMA, WMA, or VWMA.
  • Streaming returns None until the full RSI and trigger-price state is warmed up.
  • Batch mode validates the three integer axes and the MA type before evaluating the grid.
Builder, Streaming & Batch APIs
VolumeWeightedRelativeStrengthIndexBuilder::new()
    .source("close")
    .rsi_length(usize)
    .range_length(usize)
    .ma_length(usize)
    .ma_type("EMA")
    .kernel(Kernel)
    .apply_slices(&[f64], &[f64])

VolumeWeightedRelativeStrengthIndexStream::try_new(params)
stream.update(source, volume)

VolumeWeightedRelativeStrengthIndexBatchBuilder::new()
    .source("close")
    .range(VolumeWeightedRelativeStrengthIndexBatchRange { ... })
    .apply(&Candles)
    .apply_slices(&[f64], &[f64])

Python Bindings

Python exposes direct, stream, and batch helpers for the full VW-RSI output block.

from vector_ta import (
    volume_weighted_relative_strength_index,
    volume_weighted_relative_strength_index_batch,
    VolumeWeightedRelativeStrengthIndexStream,
)

single = volume_weighted_relative_strength_index(close, volume)
stream = VolumeWeightedRelativeStrengthIndexStream()
point = stream.update(close[-1], volume[-1])

batch = volume_weighted_relative_strength_index_batch(
    close,
    volume,
    rsi_length_range=(10, 18, 2),
    range_length_range=(6, 12, 2),
    ma_length_range=(10, 18, 2),
    ma_type="EMA",
)

JavaScript/WASM Bindings

The WASM layer exposes direct, batch, and into-buffer helpers for the VW-RSI panel outputs.

import init, {
  volume_weighted_relative_strength_index_js,
  volume_weighted_relative_strength_index_batch_js,
} from "vector-ta-wasm";

await init();

const single = volume_weighted_relative_strength_index_js(close, volume);
const batch = volume_weighted_relative_strength_index_batch_js(close, volume, {
  rsi_length_range: [10, 18, 2],
  range_length_range: [6, 12, 2],
  ma_length_range: [10, 18, 2],
  ma_type: "EMA",
});

CUDA Bindings (Rust)

Additional details for the CUDA bindings can be found inside the VectorTA repository.

Performance Analysis

Comparison:
View:
Placeholder data (no recorded benchmarks for this indicator)

Across sizes, Rust CPU runs about 1.14× faster than Tulip C in this benchmark.

Loading chart...

AMD Ryzen 9 9950X (CPU) | NVIDIA RTX 4090 (GPU)

Related Indicators