financial_indicators 1.0.0

A Rust library providing a comprehensive suite of financial technical indicators for cryptocurrency and stock analysis. Includes trend, momentum, volatility, volume, and other common indicators such as: - MA (Moving Average) - EMA (Exponential Moving Average) - MACD (Moving Average Convergence Divergence) - DMI/ADX (Directional Movement Index / Average Directional Index) - TRIX (Triple Exponential Average) - RSI (Relative Strength Index) - ROC (Rate of Change) - CCI (Commodity Channel Index) - Stochastic Oscillator (KDJ) - MOM (Momentum) - ATR (Average True Range) - Bollinger Bands - STD (Standard Deviation) - OBV (On-Balance Volume) - VOL (Volume) - MFI (Money Flow Index) - VWAP (Volume Weighted Average Price) - SAR (Parabolic SAR) - PSY (Psychological Line) - Williams %R - CR (Cumulative Resistance)
Documentation
# DMI / ADX (Directional Movement Index / Average Directional Index)

## Overview

The Directional Movement Index (DMI) and Average Directional Index (ADX) are trend-following indicators developed by J. Welles Wilder. DMI consists of two lines, +DI and -DI, which measure the strength of upward and downward movements, while ADX quantifies the overall strength of the trend, regardless of direction.

## Calculation

### 1. Calculate True Range (TR)

For each period:

- TR = max(High - Low, |High - Previous Close|, |Low - Previous Close|)

### 2. Calculate Directional Movements

- +DM = High - Previous High (if positive and greater than Low - Previous Low, else 0)
- -DM = Previous Low - Low (if positive and greater than High - Previous High, else 0)

### 3. Smooth the values (typically using a 14-period average)

- Smoothed TR, +DM, and -DM (usually using Wilder's smoothing method)

### 4. Calculate Directional Indicators

- +DI = 100 × (Smoothed +DM / Smoothed TR)
- -DI = 100 × (Smoothed -DM / Smoothed TR)

### 5. Calculate DX and ADX

- DX = 100 × |+DI - -DI| / (+DI + -DI)
- ADX = n-period average of DX (commonly 14)

## Usage

- **+DI and -DI Crossovers:**
  - +DI crossing above -DI may signal a bullish trend.
  - -DI crossing above +DI may signal a bearish trend.
- **ADX Value:**
  - ADX above 20 or 25 typically indicates a strong trend.
  - ADX below 20 suggests a weak or non-trending market.

## Example

Given high, low, and close prices for 15 days, calculate the 14-period DMI and ADX as described above. The first ADX value is calculated after 14 periods.

## References

- [Investopedia: Average Directional Index (ADX)]https://www.investopedia.com/terms/a/adx.asp
- [Investopedia: Directional Movement Index (DMI)]https://www.investopedia.com/terms/d/dmi.asp
- [Wikipedia: Average Directional Movement Index]https://en.wikipedia.org/wiki/Average_directional_movement_index