mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-15 09:08:04 +00:00
dependabot
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# ALMA: Benchmark Analysis
|
||||
|
||||
This analysis evaluates the Arnaud Legoux Moving Average (ALMA) across four core benchmarks: accuracy, timeliness, overshooting, and smoothness. These benchmarks provide a comprehensive view of ALMA's performance characteristics and serve as a basis for comparison with other moving averages.
|
||||
|
||||
## Accuracy (closeness to the original data)
|
||||
|
||||
ALMA generally exhibits good accuracy in representing the original price data due to its Gaussian distribution-based weighting system.
|
||||
|
||||
- **Strengths**:
|
||||
- The Gaussian distribution weighting helps to reduce noise while preserving important price trends.
|
||||
- The offset parameter allows for fine-tuning of the balance between recent and historical data representation.
|
||||
|
||||
- **Considerations**:
|
||||
- Accuracy can vary based on parameter settings. Incorrect parameter selection might lead to over-smoothing or under-smoothing, potentially reducing accuracy.
|
||||
- In highly volatile markets, ALMA may sacrifice some accuracy for smoothness, especially if the sigma parameter is set to prioritize noise reduction.
|
||||
|
||||
## Timeliness (amount of lag)
|
||||
|
||||
ALMA is designed to minimize lag, which is one of its key advantages over traditional moving averages.
|
||||
|
||||
- **Strengths**:
|
||||
- The offset parameter allows ALMA to be more responsive to recent price changes, potentially reducing lag.
|
||||
- The ability to adjust the window size provides flexibility in balancing timeliness and stability.
|
||||
|
||||
- **Considerations**:
|
||||
- While ALMA generally has less lag than traditional MAs, it's not entirely lag-free. Some minimal lag may still be present, especially with larger window sizes.
|
||||
- The amount of lag can be influenced by parameter settings. Optimizing for minimal lag might come at the cost of increased noise sensitivity.
|
||||
|
||||
## Overshooting (overcompensation during reversals)
|
||||
|
||||
ALMA's design helps to mitigate overshooting during price reversals, but the extent can vary based on settings and market conditions.
|
||||
|
||||
- **Strengths**:
|
||||
- The Gaussian distribution weighting helps to dampen extreme price movements, reducing the likelihood of significant overshooting.
|
||||
- The sigma parameter allows for control over the smoothness of transitions, potentially minimizing overshoot.
|
||||
|
||||
- **Considerations**:
|
||||
- Overshooting can still occur, especially in markets with sudden, sharp reversals.
|
||||
- The degree of overshooting can be influenced by parameter settings. More aggressive settings (lower sigma, higher offset) might increase responsiveness but also the risk of overshooting.
|
||||
|
||||
## Smoothness (continuous 2nd derivative, less jagged flow)
|
||||
|
||||
ALMA generally produces a smoother line than many traditional moving averages, which is one of its defining characteristics.
|
||||
|
||||
- **Strengths**:
|
||||
- The Gaussian distribution weighting effectively smooths out minor price fluctuations and noise.
|
||||
- The sigma parameter provides direct control over the smoothness of the line.
|
||||
- The resulting smooth line can make trend identification easier.
|
||||
|
||||
- **Considerations**:
|
||||
- The degree of smoothness can be adjusted through parameter settings.
|
||||
@@ -0,0 +1,45 @@
|
||||
# The Math Behind ALMA
|
||||
|
||||
## Components of ALMA
|
||||
|
||||
ALMA is a single-formula moving average that incorporates elements of several advanced techniques:
|
||||
|
||||
- Gaussian distribution
|
||||
- Weighted moving average
|
||||
- Offset parameter
|
||||
|
||||
### ALMA Formula
|
||||
|
||||
$ ALMA_t = \sum_{i=0}^{n-1} w_i \cdot P_{t-i} $
|
||||
|
||||
Where:
|
||||
- $ALMA_t$ is the ALMA value at time $t$
|
||||
- $n$ is the window size (number of periods)
|
||||
- $P_{t-i}$ is the price at time $t-i$
|
||||
- $w_i$ are the weights
|
||||
|
||||
### Weight Calculation
|
||||
|
||||
The weights $w_i$ are calculated using a Gaussian distribution function with an offset:
|
||||
|
||||
$ w_i = \exp\left(-\frac{(i - m)^2}{2s^2}\right) $
|
||||
|
||||
Where:
|
||||
- $i$ is the position of the price in the window (0 to $n-1$)
|
||||
- $m$ is the offset of the Gaussian distribution, calculated as $m = \text{floor}(offset \cdot (n - 1))$
|
||||
- $s$ is the standard deviation of the Gaussian distribution, calculated as $s = \frac{n}{sigma}$
|
||||
|
||||
### Parameter Definitions
|
||||
|
||||
ALMA uses three main parameters:
|
||||
|
||||
- **Window size** ($n$): Affects the overall reactivity of the indicator.
|
||||
- **Offset**: Influences the lag of the moving average. Lower values reduce lag but may increase noise.
|
||||
- **Sigma**: Controls the smoothness of the indicator. Higher values increase smoothness but may increase lag.
|
||||
|
||||
### Computational Process
|
||||
|
||||
For each new data point:
|
||||
- Calculate the weights for the entire window.
|
||||
- Apply these weights to the most recent $n$ prices.
|
||||
- Sum the weighted prices to produce the final ALMA value.
|
||||
Reference in New Issue
Block a user