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

Boolean Series

A Boolean Series represents a time-aligned sequence of true / false values derived from market data.
Instead of describing how much something moved, boolean series answer yes/no questions about the market.

They are the foundation of signals, conditions, and alarms in the DSL.


Mental Model

If Number Series describe what the market is doing,
Boolean Series describe whether a condition is met.

Examples of questions Boolean Series answer:

  • Is price above a moving average?
  • Did RSI cross below 30?
  • Is momentum increasing?
  • Did a breakout just occur?

Every boolean value corresponds to a specific point in time and can be:

  • chained
  • combined
  • used to trigger alarms

Core Characteristics

Boolean Series:

  • Are derived from Number Series or other Boolean Series
  • Always return true or false per time step
  • Can be combined logically (and, or, not)
  • Are side-effect free
  • Are evaluated lazily like all expressions in the DSL

Categories

Boolean Series expressions are grouped by the type of question they answer.


Comparison

Comparison expressions evaluate relationships between two values.

Typical use cases:

  • Threshold checks
  • Crossovers
  • Relative positioning

Syntax:

number_series.operator.number_series | scalar

Operators:

ComparatorMeaningExample
gtGreater Thanclose().gt(100)
gteGreater Than or Equalclose().gte(100.5)
ltLess Thanclose().rsi(21).lt(35)
lteLess Than or Equalclose().lte(close().ema(200))
eqEqualclose().eq(16)
neqNot Equalclose().neq(16)

Number Predicates

Number predicates evaluate conditions on a number series and return a boolean series.
They are typically used in comparisons, filters, and signal conditions.

Structure

A numeric predicate is defined by:

  • lhs: the left-hand side number series
  • predicate: the condition applied to that series
<number_series>.<predicate>
PredicateDescriptipnExample
risingReturns true if the series is rising for n consecutive pointsclose().rising(3)
fallingReturns true if the series is falling for n consecutive pointsclose().falling(3)
betweenReturns true if values stay between start and end (inclusive)close().between(30, 70)

Slope Conditions

Slope conditions evaluate directional changes between two number series and return a boolean series.
They are commonly used to detect crossovers, breakdowns, and trend shifts.

Structure

A slope condition is defined by:

  • lhs: the primary number series
  • slope: the directional relationship
  • rhs: the reference number series
<number_series>.<slope>(<number_series>)
Slope TypeDescriptionExample
CrossesAboveReturns true when lhs crosses above rhsema(9).crosses_above(ema(21))
CrossesBelowReturns true when lhs crosses below rhsema(9).crosses_below(ema(21))

Logical Operations

Logical operations combine boolean series into more complex conditions.
They allow composing simple rules into expressive signal logic.

Structure

A logical operation is defined by:

  • lhs: left-hand boolean series
  • operator: logical operator
  • rhs: right-hand boolean series
<boolean_series>.<operator>.<boolean_series>
OperatorDescriptionExample
andReturns true when both sides are truersi(14).lt(30).and(volume().rising(3))
orReturns true when either side is trueclose().gte(ema(50)).or(close().gte(sma(200)))

Boolean Modifiers

Boolean modifiers transform or constrain an existing boolean series.
They are used to add temporal context, duration guarantees, or negation to conditions.

Structure

A boolean modifier is applied directly to a boolean series:

<boolean_series>.<modifier>(params)
ModifierParametersDescriptionExample
withinn: number of candlesReturns true if the condition occurred within the last n pointsclose.rsi(21).lte(30).within(3)
held_forn: number of candlesReturns true if the condition stayed true for n consecutive pointsclose.rsi(21).gte(50).held_for(3)
not—Inverts the boolean seriesclose.rsi(21).lte(30).not()

See examples

Last Updated:: 1/28/26, 8:19 AM
Contributors: erenkizilay