Volatility Indicators

Volatility indicators measure the degree of price variation over time. Higher volatility indicates larger price swings, while lower volatility suggests more stable prices.

🌊 Understanding Volatility

  • Bollinger Bands: Price touching the upper band may indicate overbought, touching lower band may indicate oversold
  • ATR: Higher values indicate higher volatility; useful for setting stop-loss levels
  • IQR: Robust measure of spread that's less sensitive to outliers than standard deviation
  • Volatility often increases during market uncertainty and decreases during calm periods

Bollinger Bands (BBANDS)

Shows price volatility using standard deviations from a moving average

Code Example

import { BollingerBands } from 'trading-signals';

const bb = new BollingerBands(20, 2);

const prices = [
  50, 51, 52, 51, 50, 49, 50, 51, 52,
  53, 54, 53, 52, 51, 50, 49, 50, 51,
  52, 53, 54,
];

prices.forEach((p) => bb.add(p));

// After enough values, you can read the result
const { upper, middle, lower } = bb.getResultOrThrow();
console.log('Upper:', upper);
console.log('Middle:', middle);
console.log('Lower:', lower);

Interactive Demo

Current Result:
Not enough data
Values & Results (0 total):

Average True Range (ATR)

Measures market volatility by analyzing the range of price movements

Code Example

import { ATR } from 'trading-signals';

const atr = new ATR(14);

atr.add({
  high: 55,
  low: 45,
  close: 50
});

console.log(atr.getResult());

Interactive Demo

Current Result:
Not enough data
Values & Results (0 total):

Interquartile Range (IQR)

Statistical measure of variability, showing the middle 50% of data

Code Example

import { IQR } from 'trading-signals';

const iqr = new IQR(13);

const prices = [
  7, 7, 31, 31, 47, 75, 87,
  115, 116, 119, 119, 155, 177
];

for (const price of prices) {
  iqr.add(price);
}

console.log(iqr.getResultOrThrow()); // 88

Interactive Demo

Current Result:
Not enough data
Values & Results (0 total):

Other Volatility Indicators

ABANDS

Acceleration Bands - volatility bands based on price momentum

BBW

Bollinger Bands Width - measures the width of the bands

MAD

Mean Absolute Deviation - average absolute deviation from mean

TR

True Range - measures volatility of high-low-close

⚠️ Important Disclaimer

Signals by technical trading indicators are not guarantees. Always use proper risk management, confirm signals with multiple indicators, and never rely on a single indicator for trading decisions. This library is for educational purposes and does not constitute financial advice.