---
url: /indicators/beta.md
description: >-
  Beta coefficient with Beta+/Beta- shows how strongly one asset's price
  responds to systemic volatility of the entire market.  Upside Beta (Beta+) and
  Downside Beta (Beta-), popularized by Harry M. Markowitz, are also included.
package: FacioQuo.Stock.Indicators
docs_version: v3
canonical: https://dotnet.stockindicators.dev/indicators/beta
generated: 2026-09-30T04:41:06.055Z
commit: ae1f432eaa0b03ae9f39e032c69434b557efa4a2
---

# Beta coefficient (β)

[Beta](https://en.wikipedia.org/wiki/Beta_\(finance\)) shows how strongly one asset's price responds to systemic volatility of the entire market. Beta measures an asset's non-diversifiable systematic risk — its market exposure — not its idiosyncratic, asset-specific risk. [Upside Beta](https://en.wikipedia.org/wiki/Upside_beta) (Beta+) and [Downside Beta](https://en.wikipedia.org/wiki/Downside_beta) (Beta-), [popularized by Harry M. Markowitz](https://www.jstor.org/stable/j.ctt1bh4c8h), are also included.  Beta+ and Beta- capture asymmetric sensitivity during rising and falling markets. [\[Discuss\] 💬](https://github.com/facioquo/stock-indicators-dotnet/discussions/268 "Community discussion about this indicator")

```csharp
// C# usage syntax
IReadOnlyList<BetaResult> results = barsEval
  .ToBeta(barsMarket, lookbackPeriods, type);
```

## Parameters

| param | type | description |
| ----- | ---- | ----------- |
| `barsEval` | *`IReadOnlyList<TBar>`* | [Historical price bars](/guide/getting-started.md#historical-bars) used as the evaluation subject.  You must have the same number of periods as `barsMarket`. |
| `barsMarket` | *`IReadOnlyList<TBar>`* | [Historical price bars](/guide/getting-started.md#historical-bars) used as the benchmark basis for comparison.  This is usually market index data.  You must have the same number of periods as `barsEval`. |
| `lookbackPeriods` | *`int`* | Number of periods (`N`) in the lookback window.  Must be greater than 0 to calculate; however we suggest a larger period for statistically appropriate sample size and especially when using Beta +/-. |
| `type` | *`BetaType`* | Type of Beta to calculate.  Default is `BetaType.Standard`. See [`BetaType` options](#betatype-options) below. |

### Historical price bars requirements

You must have at least `N` periods of `barsEval` and `barsMarket` to cover the warmup periods.  More than the minimum is typically provided, since a larger sample improves statistical quality — especially when using Beta +/-.

`barsEval` and `barsMarket` must have consistent frequency (day, hour, minute, etc).  Mismatch histories will throw `InvalidBarsException`. See [the Guide](/guide/getting-started.md#historical-bars) for more information.

### `BetaType` options

| type                | description                                                                                |
| ------------------- | ------------------------------------------------------------------------------------------ |
| `BetaType.Standard` | Standard Beta only.  Uses all historical price bars. (default)                             |
| `BetaType.Up`       | Upside Beta only.  Uses market up bars only.                                               |
| `BetaType.Down`     | Downside Beta only.  Uses market down bars only.                                           |
| `BetaType.All`      | Returns all of the above.  Required for `Ratio` and `Convexity` values.  Note: 3× slower.  |

> [!TIP]
> **✨ Pro tip**
>
> Financial institutions often depict a single number for Beta on their sites.  To get that same long-term Beta value, use 5 years of monthly bars for `bars` and a value of 60 for `lookbackPeriods`.  If you only have smaller bars, use the [Aggregate()](/utilities/bars.md#resize-bar-history) utility to convert it.
>
> [Alpha](https://en.wikipedia.org/wiki/Alpha_\(finance\)) is calculated as `R – Rf – Beta (Rm - Rf)`, where `Rf` is the risk-free rate.

## Response

```csharp
IReadOnlyList<BetaResult>
```

* This method returns a time series of all available indicator values for the `bars` provided.
* It always returns the same number of elements as there are in the historical price bars.
* It does not return a single incremental indicator value.
* The first `N-1` periods will have `null` values since there's not enough data to calculate.

### `BetaResult`

| property | type | description |
| -------- | ---- | ----------- |
| `Timestamp` | *`DateTime`* | Date from evaluated `TBar` |
| `Beta` | *`double`* | Beta coefficient based |
| `BetaUp` | *`double`* | Beta+ (Up Beta) |
| `BetaDown` | *`double`* | Beta- (Down Beta) |
| `Ratio` | *`double`* | Beta ratio is `BetaUp/BetaDown` |
| `Convexity` | *`double`* | Beta convexity is (BetaUp-BetaDown)2 |
| `ReturnsEval` | *`double`* | Returns of evaluated bars (`R`) |
| `ReturnsMrkt` | *`double`* | Returns of market bars (`Rm`) |

### Utilities

* [.Condense()](/utilities/results.md#condense)
* [.Find(lookupDate)](/utilities/results.md#find-by-date)
* [.RemoveWarmupPeriods()](/utilities/results.md#remove-warmup-periods)
* [.RemoveWarmupPeriods(removePeriods)](/utilities/results.md#remove-warmup-periods)

See [Utilities and helpers](/utilities.md) for more information.

## Chaining

This indicator may be generated from any chain-enabled indicator or method.

```csharp
// example
var results = barsEval
    .Use(CandlePart.HL2)
    .ToBeta(barsMarket.Use(CandlePart.HL2), ..);
```

> [!WARNING]
> **🚩**
>
> Both eval and market arguments must contain the same number of elements and be the results of a chainable indicator or `.Use()` method.

Results can be further processed on `Beta` with additional chain-enabled indicators.

```csharp
// example
var results = barsEval
    .ToBeta(barsMarket, ..)
    .ToSlope(..);
```

See [Chaining indicators](/guide/chaining.md) for more.

## Streaming

Streaming is not supported for this indicator. This indicator requires a second synchronized bar series, which cannot be expressed in the single-series streaming model. Use the Series (batch) implementation with periodic recalculation instead.
