pct_change
Percent Change between two values
pct_change(current, base)
Parameters
| Name | Type | Description |
|---|---|---|
current |
field | Current/new value (numerator difference component) |
base |
field | Base/reference value (denominator) |
Formula
pct_change = ((current - base) / base) * 100
Examples
// Daily change: close vs previous close
pct_change(close, close[1]) > 5; // Up more than 5% from yesterday
// Gap percentage: open vs previous close
pct_change(open, close[1]) > 2; // Gapped up more than 2%
// Intraday range: high vs low
pct_change(high, low) > 3; // Bar range exceeds 3%
// Weekly momentum
pct_change(close, close[5]) > 10; // Up more than 10% over 5 bars
// Compare to moving average
pct_change(close, sma(close, 20)) > 5; // 5%+ above 20-day SMA
// Volume surge vs average
pct_change(volume, sma(volume, 20)) > 100; // Volume 2x+ average
// Find big losers
pct_change(close, close[1]) < -5; // Down more than 5% today
// Compare high to previous high
pct_change(high, high[1]) > 0; // Higher high (any amount)
Returns
float
Notes
Returns NULL when base = 0 (division guarded via NULLIF); stocks with a NULL result are excluded from scan results. Unlike roc(), accepts two independent values instead of an implicit lag.