VaR Pass Node

Value at Risk — Series Input

StatisticalRiskPass

Overview

The VaR Pass Node computes the rolling historical Value at Risk (VaR) — the loss threshold that is exceeded with a given confidence level within a rolling window.

At 95% confidence level, VaR tells you: "In the worst 5% of rolling periods, losses will exceed this value." It is expressed as a positive number representing the loss magnitude. VaR is the most widely used regulatory and institutional risk measure.

Formula

Historical Simulation VaR:
VaR[i] = −quantile(returns in window, 1 − confidenceLevel)
At confidenceLevel=0.95: VaR = −5th percentile of the rolling window returns.
Positive output = magnitude of the loss at the confidence threshold. Higher VaR = more risk.

Parameters

ParameterDefaultDescription
period20Rolling window in bars
confidenceLevel0.95Confidence level (e.g. 0.95 = 95% VaR)

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Returns series
valuesOutput(number | null)[]Historical VaR per bar (positive = loss magnitude); nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Position Sizing

Scale position size so that 95% VaR never exceeds a fixed dollar or percent of portfolio threshold — a VaR-constrained sizing approach.

Risk Monitoring

Alert when rolling VaR exceeds a historical regime level — rising VaR indicates entering a higher-risk market environment.

Regulatory Compliance

VaR is the standard risk measure for regulatory reporting (Basel III, MiFID II). Use rolling VaR to ensure ongoing compliance with risk limits.

Tips & Best Practices

VaR Underestimates Tail Risk

VaR tells you the loss threshold, not how bad losses beyond the threshold can be. Combine with CVaR Pass to capture expected tail loss beyond VaR.

Historical vs Parametric

This node uses historical simulation (non-parametric) — no distribution assumption is made. For parametric VaR, use standard-deviation-based formulas with the Z-Score node.

Backtesting VaR

Count how often actual losses exceed rolling VaR — the violation rate should be (1−confidenceLevel). More than 5% violations at 95% VaR suggests model underestimation.

Related Indicators