[SF] VaR: excess deviation from the mean
The [SF] VaR indicator shows how much further than the benchmark an asset has moved from its moving average over the last n bars. It is not the classic Value at Risk.

The [SF] VaR indicator below the chart.
What it is
In the indicator list it is called [SFQA] Value at risk; on the chart it is labeled [SF] VaR. The name is historical: the indicator does not compute Value at Risk and does not compute a risk premium. A more honest name for what it computes is excess deviation from the mean: how much the deviation of the asset's price from its moving average changed over the last bars compared with the same measure for the benchmark, minus the risk-free rate over that time.
The indicator is available on all plans.
The classic Value at Risk is the loss that, with a given probability (for example, 95%), will not be exceeded over a given period. It is calculated from the distribution of returns. The risk premium is the difference between an asset's expected return and the risk-free rate. [SF] VaR does neither.
How it is calculated
The bar price is the typical price . For the asset and for the benchmark, the deviation from the simple moving average over bars is calculated:
The change in this deviation over bars:
The final value:
where is the asset's measure, is the benchmark's measure, is the time taken by the last bars, in years, and is the risk-free rate in percent per year.
The risk-free rate over the last bars is subtracted in the same percent units as the difference between the asset and the benchmark. A year is taken as 365 days. For example, on 10 hourly bars at a rate of 10.95% the adjustment is .
Settings
| Parameter | Default | What it sets |
|---|---|---|
| Symbol | empty | Asset. Empty means the chart ticker |
| Benchmark tiker | BINANCE:BTCUSDT | Benchmark |
| Risk free rate | 10.95 | Risk-free rate, % per year |
| Length | 10 | Length in bars |
The line is green when the value is zero or above and red when it is below zero. In the Style tab you can turn on the ±2 and ±4 levels; they are hidden by default.
How to read it
- Value above zero: over the last bars the asset moved up from its average more than the benchmark moved from its own (or moved down less). The asset is stronger than the market.
- Value below zero: the asset is weaker than the benchmark.
- Sign change: relative strength has passed from the asset to the benchmark or back.
The indicator compares deviations from averages, not returns. So it reacts to a move speeding up or slowing down, not to its overall size, and it quickly returns to zero when the asset and the benchmark move the same way.
Limitations
- It is not a risk measure. The indicator cannot tell you how much you can lose on a position.
- The value depends on the chosen benchmark. For altcoins the default is BTCUSDT.
- The risk-free rate is subtracted as a fixed adjustment and has almost no effect on the result.