Skip to main content
Skip to main content
Version: Next 🚧

Volatility Indicators

Volatility indicators measure the rate and magnitude of price changes, helping traders identify breakouts, set appropriate stop losses, and adjust position sizes based on market conditions.

Bollinger Bands​

Calculation​

Bollinger Bands consist of a middle band (SMA) and two outer bands that are standard deviations away from the middle band.

Formula:

Middle Band = SMA(n)
Upper Band = SMA(n) + (k Γ— Standard Deviation)
Lower Band = SMA(n) - (k Γ— Standard Deviation)

Standard Settings:
- Period (n) = 20
- Standard Deviations (k) = 2

Step-by-Step Example (20-period, 2 StdDev):

Step 1: Calculate 20-period SMA
Prices: 100, 102, 101, 103, 105, ..., 110
SMA(20) = 104.50

Step 2: Calculate Standard Deviation
Deviations from mean: -4.5, -2.5, -3.5, -1.5, 0.5, ..., 5.5
Variance = Sum of (deviationΒ²) / 20 = 8.25
StdDev = √8.25 = 2.87

Step 3: Calculate Bands
Upper Band = 104.50 + (2 Γ— 2.87) = 110.24
Middle Band = 104.50
Lower Band = 104.50 - (2 Γ— 2.87) = 98.76

Characteristics​

  • Middle Band: 20-period SMA (standard)
  • Outer Bands: Β±2 standard deviations (standard)
  • Band Width: Indicates volatility level
  • Price Position: Shows relative price level
  • Best For: Mean reversion and breakout strategies

Band Width Interpretation​

Band WidthVolatilityMarket ConditionStrategy
NarrowLowConsolidationPrepare for breakout
NormalMediumTrendingTrend following
WideHighVolatileMean reversion
ExpandingIncreasingBreakout startingFollow momentum
ContractingDecreasingConsolidatingWait for setup

Price Position Interpretation​

Price PositionSignalAction
Above Upper BandOverboughtPotential reversal or strong trend
At Upper BandResistanceWatch for rejection or breakout
Middle BandNeutralTrend direction indicator
At Lower BandSupportWatch for bounce or breakdown
Below Lower BandOversoldPotential reversal or strong trend

Usage Examples​

Oversold Bounce (Mean Reversion):

{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_lower",
"period": 20,
"stdDev": 2,
"comparison": "below"
}
// Price below lower band = oversold, potential bounce

Upper Band Breakout:

{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_upper",
"period": 20,
"stdDev": 2,
"comparison": "crosses_above"
}
// Price breaks above upper band = strong momentum

Middle Band Crossover:

{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_middle",
"period": 20,
"comparison": "crosses_above"
}
// Price crosses above middle band = bullish

Bollinger Band Strategies​

1. Bollinger Bounce (Mean Reversion):

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "low",
"indicator": "bollinger_lower",
"period": 20,
"stdDev": 2,
"comparison": "below"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_lower",
"period": 20,
"stdDev": 2,
"comparison": "above"
}
]
}
},
"exitConditions": {
"takeProfit": {
"type": "indicator",
"indicator": "bollinger_middle",
"period": 20
}
}
}
// Enter when price touches lower band, exit at middle band

2. Bollinger Breakout:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_upper",
"period": 20,
"stdDev": 2,
"comparison": "crosses_above"
},
{
"type": "indicator_value",
"indicator": "volume",
"comparison": "above",
"value": "sma_volume_20"
}
]
}
}
}
// Enter on upper band breakout with volume confirmation

3. Bollinger Squeeze:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "custom",
"description": "Band width at 6-month low"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_upper",
"period": 20,
"stdDev": 2,
"comparison": "crosses_above"
}
]
}
}
}
// Enter when bands squeeze then price breaks out

Bollinger Band Patterns​

The Squeeze:

  • Bands contract to narrow range
  • Indicates low volatility
  • Precedes significant move
  • Trade the breakout direction

Walking the Bands:

  • Price stays near upper/lower band
  • Indicates strong trend
  • Don't fade the trend
  • Wait for reversal confirmation

Double Bottom/Top:

  • Price makes two touches of band
  • Second touch doesn't break band
  • Reversal signal
  • Enter on confirmation

Average True Range (ATR)​

Calculation​

ATR measures market volatility by calculating the average of true ranges over a specified period.

Formula:

True Range = max[(High - Low), |High - Close_prev|, |Low - Close_prev|]

ATR = Average of True Range over n periods (typically 14)

First ATR = Simple average of first 14 TR values
Subsequent ATR = ((Previous ATR Γ— 13) + Current TR) / 14

Example (14-period ATR):

Day 1: High=105, Low=100, Close_prev=102
TR = max[(105-100), |105-102|, |100-102|]
= max[5, 3, 2] = 5

Day 2: High=108, Low=103, Close_prev=105
TR = max[(108-103), |108-105|, |103-105|]
= max[5, 3, 2] = 5

Days 1-14: Calculate average
ATR = (5 + 5 + 4 + 6 + ... + 5) / 14 = 4.8

Day 15: TR = 6
ATR = ((4.8 Γ— 13) + 6) / 14 = 4.89

Characteristics​

  • Range: 0 to unlimited (in price units)
  • Period: 14 (standard)
  • Interpretation: Higher ATR = higher volatility
  • Use: Position sizing, stop loss placement
  • Not Directional: Doesn't indicate trend direction

ATR Interpretation​

ATR LevelVolatilityImplications
Low ATRLow volatilityTight stops, smaller positions, breakout pending
Normal ATRAverage volatilityStandard position sizing
High ATRHigh volatilityWider stops, smaller positions, trending
Rising ATRIncreasing volatilityTrend strengthening or starting
Falling ATRDecreasing volatilityTrend weakening or consolidating

Usage Examples​

ATR-Based Stop Loss:

{
"exitConditions": {
"stopLoss": {
"type": "atr",
"atrPeriod": 14,
"atrMultiplier": 2.0
}
}
}
// Stop loss = Entry Β± (2 Γ— ATR)

High Volatility Filter:

{
"type": "indicator_value",
"indicator": "atr",
"period": 14,
"comparison": "above",
"value": "sma_atr_50"
}
// ATR above 50-period average = high volatility

Volatility Breakout:

{
"type": "indicator_value",
"indicator": "atr",
"period": 14,
"comparison": "crosses_above",
"value": "sma_atr_20"
}
// ATR crosses above its average = volatility expansion

ATR Applications​

1. Position Sizing:

Position Size = Risk Amount / (ATR Γ— Multiplier)

Example:
Risk per trade = $1000
ATR = 2.50
Multiplier = 2.0

Position Size = $1000 / (2.50 Γ— 2.0) = 200 shares

2. Stop Loss Placement:

Long Stop = Entry - (ATR Γ— Multiplier)
Short Stop = Entry + (ATR Γ— Multiplier)

Example (Long):
Entry = $100
ATR = $2.50
Multiplier = 2.0

Stop Loss = $100 - ($2.50 Γ— 2.0) = $95

3. Profit Target:

Target = Entry + (ATR Γ— Multiplier)

Example:
Entry = $100
ATR = $2.50
Multiplier = 3.0

Target = $100 + ($2.50 Γ— 3.0) = $107.50

ATR Multiplier Guidelines​

MultiplierUse CaseRisk Level
1.0-1.5Tight stops, scalpingHigh (more stops)
2.0Standard stopsMedium
2.5-3.0Swing tradingLow (fewer stops)
3.0+Position tradingVery low

Keltner Channels​

Calculation​

Keltner Channels use ATR to set channel width around an EMA, combining trend and volatility.

Formula:

Middle Line = EMA(n)
Upper Channel = EMA(n) + (ATR(n) Γ— Multiplier)
Lower Channel = EMA(n) - (ATR(n) Γ— Multiplier)

Standard Settings:
- EMA Period = 20
- ATR Period = 10
- Multiplier = 2.0

Example (20 EMA, 10 ATR, 2.0 multiplier):

EMA(20) = 105.00
ATR(10) = 2.50

Upper Channel = 105.00 + (2.50 Γ— 2.0) = 110.00
Middle Line = 105.00
Lower Channel = 105.00 - (2.50 Γ— 2.0) = 100.00

Characteristics​

  • Middle Line: EMA (typically 20)
  • Channel Width: ATR-based (adapts to volatility)
  • Multiplier: 2.0 (standard)
  • Best For: Trend following and breakouts
  • Advantage: Adapts to volatility changes

Interpretation​

Price PositionSignalAction
Above Upper ChannelStrong uptrendHold long, avoid shorts
Between Middle & UpperUptrendLook for long entries
At Middle LineNeutralTrend direction indicator
Between Lower & MiddleDowntrendLook for short entries
Below Lower ChannelStrong downtrendHold short, avoid longs

Usage Examples​

Trend Following:

{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_middle",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "above"
}
// Price above middle line = uptrend

Breakout Entry:

{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_upper",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "crosses_above"
}
// Price breaks above upper channel = strong momentum

Channel Bounce:

{
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "low",
"indicator": "keltner_lower",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "below"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_lower",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "above"
}
]
}
// Price touches lower channel and bounces

Keltner Channel Strategies​

1. Keltner Breakout:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_upper",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "crosses_above"
},
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
}
]
}
}
}
// Enter on upper channel breakout with strong trend

2. Keltner Trend Following:

{
"entryConditions": {
"long": {
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_middle",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "crosses_above"
}
]
}
},
"exitConditions": {
"stopLoss": {
"type": "indicator",
"indicator": "keltner_lower",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0
}
}
}
// Enter on middle line cross, stop at lower channel

Comparison: Bollinger Bands vs Keltner Channels​

FeatureBollinger BandsKeltner Channels
BasisSMAEMA
Width CalculationStandard DeviationATR
ResponsivenessMediumHigh
Best ForMean reversionTrend following
Breakout SignalsLess frequentMore frequent
False SignalsFewerMore
Volatility AdaptationGoodExcellent

Combined Strategy​

Bollinger + Keltner Squeeze:

  • When Bollinger Bands are inside Keltner Channels = low volatility
  • Breakout from this squeeze = high-probability trade
  • Trade in direction of breakout
{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "custom",
"description": "Bollinger Bands inside Keltner Channels"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_upper",
"period": 20,
"comparison": "crosses_above"
}
]
}
}
}

Volatility Indicator Combinations​

1. Bollinger Bands + ATR (Adaptive Stops)​

Setup:

  • Bollinger Bands(20,2) for entries
  • ATR(14) for stop loss placement

Entry:

  • Price touches lower Bollinger Band

Stop Loss:

  • Entry - (2 Γ— ATR)
{
"entryConditions": {
"long": {
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "bollinger_lower",
"period": 20,
"stdDev": 2,
"comparison": "below"
}
]
}
},
"exitConditions": {
"stopLoss": {
"type": "atr",
"atrPeriod": 14,
"atrMultiplier": 2.0
}
}
}

2. Keltner Channels + Volume (Confirmed Breakouts)​

Setup:

  • Keltner Channels(20,10,2) for breakout
  • Volume for confirmation

Entry:

  • Price breaks above upper Keltner
  • Volume > average volume
{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "keltner_upper",
"period": 20,
"atrPeriod": 10,
"multiplier": 2.0,
"comparison": "crosses_above"
},
{
"type": "indicator_value",
"indicator": "volume",
"comparison": "above",
"value": "sma_volume_20"
}
]
}
}
}

Best Practices​

Do's​

  • βœ… Use Bollinger Bands for mean reversion in ranging markets
  • βœ… Use Keltner Channels for trend following
  • βœ… Use ATR for position sizing and stop placement
  • βœ… Adjust band/channel parameters for different timeframes
  • βœ… Combine with volume for breakout confirmation
  • βœ… Use wider bands/channels in volatile markets

Don'ts​

  • ❌ Assume price will always bounce at bands (can walk the bands)
  • ❌ Use fixed stop losses in volatile markets (use ATR)
  • ❌ Ignore ATR when sizing positions
  • ❌ Trade breakouts without volume confirmation
  • ❌ Use same parameters for all instruments
  • ❌ Fade strong trends just because price is at band

Common Pitfalls​

Problem: Selling at upper band in strong uptrend Solution: Use trend filter (EMA or ADX) before mean reversion trades

2. Fixed Stop Losses in Volatile Markets​

Problem: Stops too tight, get stopped out frequently Solution: Use ATR-based stops that adapt to volatility

3. Ignoring Volume on Breakouts​

Problem: False breakouts without volume Solution: Require volume confirmation for breakout trades