RunLength

The signed length of the current run of same-direction changes in a series — a streak counter.

Each update compares the value to the previous one and extends, flips, or breaks the streak: a positive value is an up-streak of that many consecutive rises, a negative value is a down-streak, and zero means the last change was flat (an unchanged value breaks the run). There is no lookback window; the streak accumulates from the last direction change.

e.g. closes 100, 101, 102, 103 → +3 (three consecutive rises); a following 101 flips it to -1; a following 101 again (unchanged) breaks it to 0.

Value is null until the first change is seen (one prior value is needed). Deterministic across backtest and live. Fed the close series it counts a daily-close run; fed any expression it counts that expression's run.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val isReady: Boolean

True once the indicator has received at least warmupBars samples.

Link copied to clipboard
open override val warmupBars: Int = 1

Number of inputs the indicator must observe before value returns non-null.

Functions

Link copied to clipboard
Link copied to clipboard
infix fun IndicatorOutput.gt(threshold: BigDecimal): Rule
Link copied to clipboard
infix fun IndicatorOutput.lt(threshold: BigDecimal): Rule
Link copied to clipboard
open override fun update(input: BigDecimal)

Feed one input to the indicator. Effects on value / isReady are immediate.

Link copied to clipboard
open override fun value(): BigDecimal?

Latest computed value, or null until isReady is true.