Beta

class Beta(period: Int) : BiIndicator

Rolling beta of a dependent series against an independent ("market") series over the last period aligned pairs: how much the first series moves per unit move of the second.

beta = Cov(a, b) / Var(b), with a the dependent series and b the independent one. e.g. BETA(asset.close, market.close, 60) — beta of 1.5 means the asset moves ~1.5× the market. Used for hedge ratios and market-neutral sizing.

Returns null until warmed up, and null when the independent series is flat (zero variance → beta undefined). O(period) per update.

Constructors

Link copied to clipboard
constructor(period: Int)

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

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(a: BigDecimal, b: BigDecimal)

Feed one aligned pair. Effects on value / isReady are immediate.

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

Latest computed value, or null until isReady is true.