Module moving_average

Module moving_average 

Source
Expand description

§Moving Average Indicators

The moving_average module provides functions for calculating moving averages, a core component of many technical indicators and trading strategies. A moving average smooths out price data by creating a constantly updated average price, helping to filter out noise and reveal trends.

§When to Use

Use these functions when you want to:

  • Smooth raw price data
  • Identify trends and trend reversals
  • Serve as a basis for other indicators (e.g., MACD, Bollinger Bands)
  • Experiment with advanced or custom moving average models

§Structure

  • single: Functions that return a single value for a slice of prices.
  • bulk: Functions that compute values of a slice of prices over a period and return a vector.

§Included Functions

§Bulk

  • mcginley_dynamic: McGinley Dynamic Moving Average (adaptive smoothing)
  • moving_average: Configurable moving average (Simple, Smoothed, Exponential, or Personalized)

§Single

§API Details

  • Functions accept slices of f64 prices and a moving average type or relevant parameters.
  • Supported types include: Simple, Smoothed, Exponential, and Personalized (custom alpha).
  • The McGinley Dynamic is an adaptive moving average that adjusts automatically to market speed.
  • See function-level docs for formulas, panics, and usage examples.

Modules§

bulk
bulk: Functions that compute values of a slice of prices over a period and return a vector.
single
single: Functions that return a single value for a slice of prices.