Premier RSI Oscillator

Parameters: rsi_length = 14 | stoch_length = 8 | smooth_length = 25

Overview

Premier RSI Oscillator starts with a standard RSI calculation, measures that RSI value inside a rolling stochastic window, then smooths the normalized signal twice before applying a hyperbolic tangent transform. The result is a bounded oscillator that is designed to react faster than a plain RSI while still filtering some of the short-term noise that comes from raw stochastic swings.

In VectorTA the indicator returns a single value series and supports direct slice input, candle input with an explicit source field, streaming updates, and parameter sweeps across its three numeric controls. Non-finite values reset the stream path, which keeps the rolling RSI and stochastic state coherent after data gaps.

Defaults: `rsi_length = 14`, `stoch_length = 8`, and `smooth_length = 25`.

Implementation Examples

Run the indicator on a direct close slice or on candle data with an explicit source field.

use vector_ta::indicators::premier_rsi_oscillator::{
    premier_rsi_oscillator,
    PremierRsiOscillatorInput,
    PremierRsiOscillatorParams,
};
use vector_ta::utilities::data_loader::{Candles, read_candles_from_csv};

let direct = premier_rsi_oscillator(&PremierRsiOscillatorInput::from_slice(
    &close,
    PremierRsiOscillatorParams {
        rsi_length: Some(14),
        stoch_length: Some(8),
        smooth_length: Some(25),
    },
))?;

let candles: Candles = read_candles_from_csv("data/sample.csv")?;
let from_candles = premier_rsi_oscillator(&PremierRsiOscillatorInput::from_candles(
    &candles,
    "close",
    PremierRsiOscillatorParams::default(),
))?;

println!("latest = {:?}", direct.values.last());
println!("candle latest = {:?}", from_candles.values.last());

API Reference

Input Methods
PremierRsiOscillatorInput::from_candles(&Candles, "close", PremierRsiOscillatorParams)
    -> PremierRsiOscillatorInput

PremierRsiOscillatorInput::from_slice(&[f64], PremierRsiOscillatorParams)
    -> PremierRsiOscillatorInput

PremierRsiOscillatorInput::with_default_candles(&Candles)
    -> PremierRsiOscillatorInput
Parameters Structure
pub struct PremierRsiOscillatorParams {
    pub rsi_length: Option<usize>,    // default 14
    pub stoch_length: Option<usize>,  // default 8
    pub smooth_length: Option<usize>, // default 25
}
Output Structure
pub struct PremierRsiOscillatorOutput {
    pub values: Vec<f64>,
}
Validation, Warmup & NaNs
  • The input slice must not be empty and must contain at least one finite value.
  • rsi_length, stoch_length, and smooth_length must all be greater than 0.
  • The direct path requires enough valid data for the resolved warmup of first_valid + rsi_length + stoch_length - 1.
  • The streaming warmup reported by get_warmup_period() is rsi_length + stoch_length - 1.
  • Non-finite stream input resets the RSI and stochastic state and returns None.
  • Batch mode validates all sweep ranges and rejects non-batch kernels.
Builder, Streaming & Batch APIs
PremierRsiOscillatorBuilder::new()
    .rsi_length(usize)
    .stoch_length(usize)
    .smooth_length(usize)
    .kernel(Kernel)
    .apply(&Candles, "close")
    .apply_slice(&[f64])
    .into_stream()

PremierRsiOscillatorStream::try_new(params)
stream.update(f64) -> Option<f64>
stream.reset()
stream.get_warmup_period() -> usize

PremierRsiOscillatorBatchBuilder::new()
    .rsi_length_range(start, end, step)
    .stoch_length_range(start, end, step)
    .smooth_length_range(start, end, step)
    .kernel(Kernel)
    .apply_slice(&[f64])
    .apply_candles(&Candles, "close")

Python Bindings

Python exposes a scalar function, a stream class with a warmup property, and a batch helper that returns a value matrix plus the resolved length axes.

from vector_ta import (
    premier_rsi_oscillator,
    premier_rsi_oscillator_batch,
    PremierRsiOscillatorStream,
)

values = premier_rsi_oscillator(
    close,
    rsi_length=14,
    stoch_length=8,
    smooth_length=25,
)

stream = PremierRsiOscillatorStream(14, 8, 25)
point = stream.update(close[-1])
print("warmup =", stream.warmup_period)

batch = premier_rsi_oscillator_batch(
    close,
    rsi_length_range=(10, 14, 2),
    stoch_length_range=(6, 10, 2),
    smooth_length_range=(20, 30, 5),
)

print(batch["values"].shape)
print(batch["rsi_lengths"])

JavaScript/WASM Bindings

The WASM layer exposes a high-level object-returning call, a batch helper, and lower-level allocation and into-buffer functions for caller-managed memory.

import init, {
  premier_rsi_oscillator_js,
  premier_rsi_oscillator_batch_js,
  premier_rsi_oscillator_alloc,
  premier_rsi_oscillator_free,
  premier_rsi_oscillator_into,
  premier_rsi_oscillator_batch_into,
} from "vector-ta-wasm";

await init();

const single = premier_rsi_oscillator_js(close, 14, 8, 25);
console.log(single.values);

const batch = premier_rsi_oscillator_batch_js(close, {
  rsi_length_range: [10, 14, 2],
  stoch_length_range: [6, 10, 2],
  smooth_length_range: [20, 30, 5],
});

const ptrIn = premier_rsi_oscillator_alloc(close.length);
const ptrOut = premier_rsi_oscillator_alloc(close.length);
premier_rsi_oscillator_into(ptrIn, ptrOut, close.length, 14, 8, 25);
premier_rsi_oscillator_free(ptrIn, close.length);
premier_rsi_oscillator_free(ptrOut, close.length);

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