RSTD -- Rolling Standard Deviation

Contents


Overview

Rolling Standard Deviation (RSTD) measures the dispersion of closing prices around their rolling mean over the last N candles. In simple terms, it tells you how spread out recent prices are -- it quantifies volatility based on close-to-close variation.

The calculation is straightforward: take the last N closing prices, compute their mean, then compute the standard deviation. A high RSTD means closing prices have been scattered far from their average -- the market is volatile. A low RSTD means closing prices are clustered tightly around their average -- the market is quiet and compressed.

The key distinction from ATR: ATR uses the high-low-close True Range, capturing intrabar volatility (wicks, gaps). RSTD uses only closing prices, capturing close-to-close variation. This makes RSTD the foundation for both Z-Score and Bollinger Bands. If you think of ATR as "how wide do candles get," think of RSTD as "how much do closes jump around." Both are volatility measures, but they capture different dimensions of it.


Format

rstd_{period}

The period defines the lookback window -- how many closing prices are included in the standard deviation calculation.

ExamplePeriodUse Case
rstd_2020Standard -- matches Bollinger Band default, good balance of responsiveness and smoothness
rstd_5050Slower -- captures longer-term volatility regime, filters out short spikes
rstd_1010Fast -- reacts quickly to sudden volatility shifts, noisier

Period range: 5 to 500.

Value range: 0 to infinity (always positive, denominated in the asset's price currency -- same units as price and ATR).


Understanding RSTD Values

Like ATR, RSTD values are not normalized to a fixed scale. They are denominated in the same currency as the asset's price. This means RSTD thresholds must be calibrated per asset and timeframe.

AssetTimeframeTypical RSTD(20) RangeWhat It Means
BTC/USDC1h150 -- 600BTC closes typically deviate $150--$600 from their 20-period mean
BTC/USDC1d800 -- 2,500BTC daily closes deviate $800--$2,500 from their 20-day mean
ETH/USDC1h10 -- 50ETH closes typically deviate $10--$50 from their 20-period mean
SOL/USDC1h0.30 -- 2.50SOL closes typically deviate $0.30--$2.50 from their 20-period mean

Note

The values above are illustrative and vary with market conditions. During high-volatility events, RSTD can spike to 3--5x its normal range. Always check recent RSTD values for your specific pair and timeframe. Backtesting is the best way to calibrate thresholds.


Understanding Operators with RSTD

Each operator behaves differently with RSTD. Because RSTD is a volatility filter (it describes the market's current dispersion, not direction), it is almost always used in combination with directional triggers.

> (Greater Than) -- State-Based

What it does: The trigger is true on every candle where RSTD is above the threshold.

On the chart: Price dispersion is elevated. Closing prices are jumping around significantly from candle to candle. This trigger stays active for as long as RSTD remains above the threshold.

[[actions.triggers]]
indicator = "rstd_20"
operator = ">"
target = "400"
timeframe = "1h"

Typical use: "Only trade when close-to-close variation is high enough." High RSTD means there is enough directional movement in closing prices to justify entry. This filters out sideways chop where candles have large wicks but close near each other.

< (Less Than) -- State-Based

What it does: The trigger is true on every candle where RSTD is below the threshold.

On the chart: Price dispersion is compressed. Closes are clustering tightly around the mean -- a volatility squeeze. This is the setup phase before many breakouts.

[[actions.triggers]]
indicator = "rstd_20"
operator = "<"
target = "150"
timeframe = "1h"

Typical use: Detect low-dispersion squeeze environments. When RSTD drops to unusually low levels, it means prices are coiling. Combine with a directional breakout trigger to enter when the squeeze resolves.

cross_above -- Event-Based

What it does: Fires once, at the exact candle where RSTD transitions from below the threshold to above it. The previous candle had RSTD <= the target, and the current candle has RSTD > the target.

[[actions.triggers]]
indicator = "rstd_20"
operator = "cross_above"
target = "300"
timeframe = "1h"

Typical use: Detect the moment volatility expands. This captures the transition from a compressed market to a dispersed one -- the squeeze is breaking. Combine with a directional indicator (RSI, ROC, or MACD) to determine entry direction.

cross_below -- Event-Based

What it does: Fires once, at the exact candle where RSTD transitions from above the threshold to below it. The previous candle had RSTD >= the target, and the current candle has RSTD < the target.

[[actions.triggers]]
indicator = "rstd_20"
operator = "cross_below"
target = "200"
timeframe = "1h"

Typical use: Detect the moment volatility contracts. Useful for exiting positions when the market quiets down, or for initiating squeeze-detection logic -- once RSTD drops below the threshold, start watching for a breakout.

Why: RSTD produces floating-point values that are rarely exactly equal to any specific number. Use > or < instead.

Choosing the right operator

  • Use > to ensure close-to-close dispersion is high enough for meaningful moves. This is the most common RSTD operator.
  • Use < to detect volatility squeezes where price is coiling before a breakout.
  • Use cross_above / cross_below to detect the exact moment a volatility regime changes.

TOML Examples

Volatility Expansion: Short vs Long Period

Compare short-period RSTD against long-period RSTD to detect volatility expansion. When the fast RSTD exceeds the slow RSTD, recent volatility is accelerating relative to the longer-term norm -- a breakout may be underway. Combine with positive momentum to enter long.

[[actions]]
type = "open_long"
amount = "100 USDC"

  [[actions.triggers]]
  indicator = "rstd_20"
  operator = ">"
  target = "rstd_50"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "roc_10"
  operator = ">"
  target = "1.5"
  timeframe = "1h"

Low Volatility Squeeze Entry

Wait for a volatility squeeze (RSTD drops to unusually low levels) and then enter when price breaks above the upper Bollinger Band. The combination of compressed volatility + directional breakout often produces outsized moves.

[[actions]]
type = "open_long"
amount = "100 USDC"

  [[actions.triggers]]
  indicator = "rstd_20"
  operator = "<"
  target = "150"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "price"
  operator = ">"
  target = "bb_upper"
  timeframe = "1h"

RSI Dip Buy with Volatility Filter

A classic dip-buy strategy enhanced with an RSTD filter. Only enter when RSI is oversold AND close-to-close dispersion is high enough that a meaningful bounce is likely. This avoids buying dips in dead, flat markets where the "bounce" is a few cents.

[[actions]]
type = "open_long"
amount = "100 USDC"

  [[actions.triggers]]
  indicator = "rsi_14"
  operator = "<"
  target = "30"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "rstd_20"
  operator = ">"
  target = "300"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "sma_50"
  operator = ">"
  target = "sma_200"
  timeframe = "1d"

Tips

RSTD is NOT directional

Like ATR, RSTD measures the magnitude of price variation, not the direction. A high RSTD during a selloff is the same as a high RSTD during a rally. Never use RSTD as a buy or sell signal on its own. It is a filter that tells you whether the market is moving, not which way.

RSTD values are asset-specific

You cannot use the same RSTD threshold for BTC and SOL. BTC's RSTD(20) on the hourly chart might be 400, while SOL's might be 1.20. Always calibrate your RSTD thresholds by checking the indicator's recent values for the specific pair and timeframe. Backtesting is the best way to find appropriate thresholds.

Compare short vs long periods for squeeze-breakout

One of the most effective RSTD patterns is comparing a short-period RSTD against a long-period RSTD. When rstd_20 < rstd_50, recent volatility is below the longer-term norm -- a squeeze is forming. When rstd_20 > rstd_50, volatility is expanding. This relative comparison adapts automatically to changing market conditions, unlike a fixed threshold.

RSTD is the foundation of Z-Score

Z-Score is calculated as (price - mean) / rstd. If you understand RSTD, you understand the denominator of Z-Score. When RSTD is low, even a small price move produces a large Z-Score. When RSTD is high, it takes a big price move to produce an extreme Z-Score. Combining RSTD with Z-Score gives you both the volatility context and the statistical position of price.