Files
Miha Kralj 35a6702b06 fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
Deep review of all indicator categories verified .md headers against .cs WarmupPeriod, parameters, inputs, and outputs. Fixes include warmup corrections, parameter documentation, output type accuracy, and Pine Script alignment.
2026-03-10 18:38:23 -07:00

34 lines
1.2 KiB
Plaintext

// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Volume Rate of Change (VROC)", "VROC", overlay=false)
//@function Calculates Volume Rate of Change
//@param vol Volume series for rate of change calculation
//@param period Number of periods for comparison
//@param calc_type Calculation type: true for percentage, false for point change
//@returns Volume Rate of Change value
//@optimized for performance and dirty data
vroc(simple int period, simple bool calc_type, series float vol = volume) =>
float current_volume = vol
float historical_volume = vol[period]
if na(current_volume) or na(historical_volume)
na
else if calc_type
historical_volume != 0.0 ? ((current_volume - historical_volume) / historical_volume) * 100.0 : na
else
current_volume - historical_volume
// ---------- Main loop ----------
// Inputs
i_period = input.int(12, "Period", minval=1, tooltip="Number of periods for comparison")
i_calc_type = input.string("Point", "Calculation Type", options=["Point", "Percent"], tooltip="Point or Percent calculation")
// Calculation
is_percent = i_calc_type == "Percent"
vroc_value = vroc(i_period, is_percent)
// Plot
plot(vroc_value, "VROC", color=color.yellow, linewidth=2)