Real-time chart analysis needs deterministic updates per bar and explicit handling of warm-up periods. WRMSE addresses this by implementing Calculates Weighted Root Mean Squared Error with parameterized inputs and direct state progression.
This implementation favors streaming execution over batch recomputation. The trade-off is more attention to state initialization, but latency stays predictable when charts scale.
Calculates Weighted Root Mean Squared ErrorCalculates WRMSE with uniform weights (equivalent to RMSE)
| Parameter | Purpose |
|---|---|
actual |
Series of actual values |
predicted |
Series of predicted/forecast values |
weight |
Series of weights for each observation |
length |
Rolling window for calculation |
actual |
Series of actual values |
predicted |
Series of predicted/forecast values |
length |
Rolling window for calculation |
- WRMSE value in same units as original data
| Input variable | Type | Configuration |
|---|---|---|
i_length |
input.int |
default: 14, label: "Length" |
i_use_volume_weights |
input.bool |
default: false, label: "Use Volume as Weights" |
i_actual |
input.source |
default: close, label: "Actual" |
i_predicted |
input.source |
default: open, label: "Predicted" |
- Declared optimization: not explicitly annotated in source comments.
- Streaming model: single-pass update on each new bar.
- Warm-up behavior: outputs can be unstable until enough samples satisfy
length. - Memory model: state is kept in Pine series context rather than external buffers.
Streaming logic keeps incremental cost stable, but initialization and edge-case handling become first-class concerns. That is a deliberate choice: predictable execution beats opaque recalculation spikes in live charts.
- Open the script in TradingView and confirm it compiles under Pine Script v6.
- Validate warm-up behavior on sparse data and short histories.
- Compare output against a trusted reference implementation for the same parameters.
- Confirm parameter bounds reject invalid values without silent fallback.
- Source code:
indicators/errors/wrmse.pine - Documentation file:
indicators/errors/wrmse.md - GitHub source view: https://github.com/mihakralj/QuanTAlib/blob/main/indicators/errors/wrmse.pine
- GitHub documentation view: https://github.com/mihakralj/QuanTAlib/blob/main/indicators/errors/wrmse.md