StockBeatStockBeat
Basics
  • Number Series
  • Boolean Series
  • Examples
Alarms
Basics
  • Number Series
  • Boolean Series
  • Examples
Alarms
  • Number Series

Number Series

Number series represent numeric values aligned with each candle in time.
They are the foundation of all calculations in StockBeat.

A number series can come from:

  • Raw market data (price, volume)
  • Indicators (EMA, RSI, SMA)
  • Arithmetic expressions combining other series

Every number series produces one numeric value per candle and can be freely chained with other expressions.


Price Series

Price series expose raw OHLC market data.

NameArgumentsDescriptionExample
open–Opening price of the candleopen()
high–Highest price of the candlehigh()
low–Lowest price of the candlelow()
close–Closing price of the candleclose()
volume–Volume of the candlevolume()
mfiperiod – number of candlesThe MFI(Money Flow Index) is an volume and price based oscillator which gives money flow over n periodsmfi(14)
atrperiod – smoothing period of EMA (integer greater than 0)Average true range (ATR). A technical analysis volatility indicator, originally developed by J. Welles Wilder. The average true range is an N-day smoothed moving average of the true range values. This implementation uses exponential moving average.atr(14)
cciperiod – number of periods (integer greater than 0). Default is 20Commodity Channel Index (CCI). The commodity channel index is an oscillator originally introduced by Donald Lambert in 1980cci(20)
ceperiod - number of periods (integer greater than 0). Default is 22.
multiplier ATR factor. Default is 3.
Chandelier Exit (CE).Developed by Charles Le Beau and featured in Alexander Elder's books, the Chandelier Exit sets a trailing stop-loss based on the Average True Range (ATR). The indicator is designed to keep traders in a trend and prevent an early exit as long as the trend extends. Typically, the Chandelier Exit will be above prices during a downtrend and below prices during an uptrend.ce(22, 3, short)
erperiod - number of periods (integer greater than 0)Kaufman's Efficiency Ratio (ER).It is calculated by dividing the price change over a period by the absolute sum of the price movements that occurred to achieve that change. The resulting ratio ranges between 0.0 and 1.0 with higher values representing a more efficient or trending market.er(14)
kcperiod - number of periods (integer greater than 0).
multiplier Usually 2.
`type one of avg, up or low. For EMA use avg, for EMA + ATR of observation use up, for EMA - ATR of observation use low
Keltner Channel (KC).A Keltner Channel is an indicator showing the Average True Range (ATR) of a price surrounding a central moving average. The ATR bands are typically shown 'k' times moved away from the moving average.kc(14, 2.0, avg)
tr-The range of a day's trading is simply high - low. The true range extends it to yesterday's closing price if it was outside of today's range.
The true range is the largest of one the following:
Most recent period's high minus the most recent period's low
Absolute value of the most recent period's high minus the previous close
Absolute value of the most recent period's low minus the previous close
tr()

Trend Indicators

Used to identify direction and trend strength.

NameArgumentsDescriptionExample
smaperiod – number of candlesSimple moving averagesma(50)
emaperiod – number of candlesExponential moving averageema(20)
macdperiod – number of candles
slow_period – period for slow EMA
signal_period – period of signal EMA
type one of macd, signal or histogram
Moving average converge divergence (MACD).The MACD indicator (or "oscillator") is a collection of three time series calculated from historical price data, most often the closing pricemacd(12, 26, 9, histogram)
ppoperiod – number of candles
slow_period – period for slow EMA
signal_period – period of signal EMA
type one of macd, signal or histogram
Percentage Price Oscillator (PPO).The PPO indicator (or "oscillator") is a collection of three time series calculated from historical price data, most often the closing priceppo(12, 26, 9)

Momentum Indicators

Used to measure speed and exhaustion of price moves.

NameArgumentsDescriptionExample
rsiperiod – number of candlesThe relative strength index (RSI). It is a momentum oscillator, that compares the magnitude of recent gains and losses over a specified time period to measure speed and change of price movements of a security. It is primarily used to attempt to identify overbought or oversold conditions in the trading of an asset.rsi(21)
fsoperiod – number of candlesFast stochastic oscillator. The stochastic oscillator is a momentum indicator comparing the closing price of a security to the range of its prices over a certain period of time.fso(14)
ssoperiod – number of candles
ema_period - period for EMA (integer greater than 0). Default is 3.
Slow stochastic oscillator. Basically it is a fast stochastic oscillator smoothed with exponential moving average.sso(14, 3)

Volatility Indicators

Used to understand price dispersion and expansion.

NameArgumentsDescriptionExample
bbperiod – number of candles
multiplier - multiplier
A Bollinger Bands (BB). (BB). It is a type of infinite impulse response filter that calculates Bollinger Bands using Exponential Moving Average. The Bollinger Bands are represented by Average EMA and standard deviaton that is moved 'k' times away in both directions from calculated average value.bb(9, 2.0)
madperiod – number of candlesMean Absolute Deviation (MAD).It is the average of the absolute deviations from a central point. It is a summary statistic of statistical dispersion or variability.mad(9)

Arithmetic Operators

Arithmetic operators allow you to manipulate number series using either:

  • A scalar value
  • Another number series

All arithmetic operators return a new number series.

NameArgumentsDescriptionExample
addrhs – scalar or number seriesAdds two valuesclose().add(open()), close().add(5.5)
subrhs – scalar or number seriesSubtracts right-hand valueclose().sub(open()), close().sub(5.5)
mulrhs – scalar or number seriesMultiplies valuesclose().mul(open()), close().mul(1.5)
divrhs – scalar or number seriesDivides valuesclose().div(open()), close().div(1.5)

Chaining Number Series

Number series are designed to be composable.

You can chain multiple expressions to create derived values:

close().sub(ema(20))

Number series expressions follow strict chaining rules:

  1. Every expression returns a number series
  2. Scalars are only allowed as arguments
  3. Time alignment is implicit and automatic
  4. Missing values propagate safely
Last Updated:: 1/28/26, 8:19 AM
Contributors: erenkizilay