Skip to content

WeightedMovingAverage


class backtide.indicators.WeightedMovingAverage(period=14)

Weighted Moving Average (WMA).

A moving average where each price is multiplied by a linearly decreasing weight, placing more emphasis on recent data than the SMA but with a different weighting scheme than the EMA. Useful when you want recent prices to matter more without the recursive smoothing of EMA.

Formula:

\[WMA_t = \frac{\sum_{i=0}^{n-1} (n - i) \cdot C_{t-i}}{\sum_{i=1}^{n} i}\]

Read more on Wikipedia.

Parameters

period : int, default=14

Look-back window length.

Attributes

acronym : str

Short ticker-style acronym.

name : str
Human-readable indicator name.


See Also

ExponentialMovingAverage

Exponential Moving Average (EMA).

MovingAverageConvergenceDivergence

Moving Average Convergence Divergence (MACD).

SimpleMovingAverage

Simple Moving Average (SMA).


Methods

compute Compute the indicator on a dataset.
description Short explanation of what the indicator measures.


method backtide.indicatorscompute(data)

Compute the indicator on a dataset.

Parameters

data : np.ndarray | pd.DataFrame | pl.DataFrame

Historical OHLCV data.

Returns

np.ndarray | pd.Series | pl.Series | pd.DataFrame | pl.DataFrame

The computed values. For multi-output indicators (e.g., upper and lower bounds), return a 2d structure.



method backtide.indicatorsdescription()

Short explanation of what the indicator measures.

Returns

str

The description.