mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-07-27 20:47:44 +00:00
docs: Added VWMA support
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## 1. Summary (Introduction)
|
||||
|
||||
The `MovingAverage_Pro` is a universal, "all-in-one" moving average indicator designed for maximum flexibility and efficiency. It consolidates **seven** fundamental and advanced moving average types into a single, powerful tool, allowing the user to switch between them with a simple dropdown menu.
|
||||
The `MovingAverage_Pro` is a universal, "all-in-one" moving average indicator designed for maximum flexibility and efficiency. It consolidates **nine** fundamental and advanced moving average types into a single, powerful tool, allowing the user to switch between them with a simple dropdown menu.
|
||||
|
||||
The available moving average types are:
|
||||
|
||||
@@ -13,6 +13,7 @@ The available moving average types are:
|
||||
* **TMA** (Triangular Moving Average)
|
||||
* **DEMA** (Double Exponential Moving Average)
|
||||
* **TEMA** (Triple Exponential Moving Average)
|
||||
* **VWMA** (Volume-Weighted Moving Average)
|
||||
|
||||
As part of our professional indicator suite, it fully supports calculations on either **standard** or **Heikin Ashi** price data, providing a consistent and powerful tool for any analysis style.
|
||||
|
||||
@@ -23,23 +24,23 @@ Each moving average type offers a different balance between smoothing and respon
|
||||
### SMA (Simple Moving Average)
|
||||
|
||||
The arithmetic mean of the last `N` prices. Ideal for identifying long-term trends.
|
||||
$\text{SMA}_t = \frac{1}{N} \sum_{i=0}^{N-1} P_{t-i}$
|
||||
$$\text{SMA}_t = \frac{1}{N} \sum_{i=0}^{N-1} P_{t-i}$$
|
||||
|
||||
### EMA (Exponential Moving Average)
|
||||
|
||||
A weighted average that applies more weight to recent prices. Calculated recursively.
|
||||
$\alpha = \frac{2}{N + 1}$
|
||||
$\text{EMA}_t = (P_t \times \alpha) + (\text{EMA}_{t-1} \times (1 - \alpha))$
|
||||
$$\alpha = \frac{2}{N + 1}$$
|
||||
$$\text{EMA}_t = (P_t \times \alpha) + (\text{EMA}_{t-1} \times (1 - \alpha))$$
|
||||
|
||||
### SMMA (Smoothed Moving Average)
|
||||
|
||||
Also known as Wilder's Smoothing. Has a longer "memory" than an EMA.
|
||||
$\text{SMMA}_t = \frac{(\text{SMMA}_{t-1} \times (N-1)) + P_t}{N}$
|
||||
$$\text{SMMA}_t = \frac{(\text{SMMA}_{t-1} \times (N-1)) + P_t}{N}$$
|
||||
|
||||
### LWMA (Linear Weighted Moving Average)
|
||||
### LWMA / WMA (Linear Weighted Moving Average / Weighted Moving Average)
|
||||
|
||||
Applies linearly decreasing weights from the most recent price to the oldest.
|
||||
$\text{LWMA}_t = \frac{\sum_{i=0}^{N-1} P_{t-i} \times (N-i)}{\sum_{j=1}^{N} j}$
|
||||
Applies linearly decreasing weights from the most recent price to the oldest. WMA is equivalent to LWMA in our suite to ensure direct compatibility with TradingView standards.
|
||||
$$\text{LWMA}_t = \frac{\sum_{i=0}^{N-1} P_{t-i} \times (N-i)}{\sum_{j=1}^{N} j}$$
|
||||
|
||||
### TMA (Triangular Moving Average)
|
||||
|
||||
@@ -48,18 +49,24 @@ A double-smoothed average (SMA of an SMA) that emphasizes the middle of the data
|
||||
### DEMA (Double Exponential Moving Average)
|
||||
|
||||
A lag-reduction technique by Patrick Mulloy.
|
||||
$\text{DEMA}_t = (2 \times \text{EMA}_1) - \text{EMA}_2$
|
||||
$$\text{DEMA}_t = (2 \times \text{EMA}_1) - \text{EMA}_2$$
|
||||
|
||||
### TEMA (Triple Exponential Moving Average)
|
||||
|
||||
An advanced lag-reduction technique using triple smoothing.
|
||||
$\text{TEMA}_t = (3 \times \text{EMA}_1) - (3 \times \text{EMA}_2) + \text{EMA}_3$
|
||||
$$\text{TEMA}_t = (3 \times \text{EMA}_1) - (3 \times \text{EMA}_2) + \text{EMA}_3$$
|
||||
|
||||
### VWMA (Volume-Weighted Moving Average)
|
||||
|
||||
Integrates trading volume into the calculation. Higher volume bars have a proportionally larger influence on the resulting average, allowing the indicator to track institutional interest and true market consensus.
|
||||
$$\text{VWMA}_t = \frac{\sum_{i=0}^{N-1} (P_{t-i} \times V_{t-i})}{\sum_{i=0}^{N-1} V_{t-i}}$$
|
||||
|
||||
## 3. MQL5 Implementation Details
|
||||
|
||||
* **Universal Calculation Engine (`MovingAverage_Engine.mqh`):**
|
||||
The core logic is encapsulated in a robust engine that powers multiple indicators in our suite (including Stochastic Pro and MACD Pro).
|
||||
* **Versatility:** The engine supports calculations on both standard OHLC data and custom arrays (via `CalculateOnArray`), with advanced offset handling for complex indicators.
|
||||
* **Overloaded Volume Interface:** High-precision overload patterns are provided for Volume-sensitive calculations like `VWMA`. If volume data is not passed, the calculator executes a robust fallback mechanism to SMA with a warning print.
|
||||
|
||||
* **Optimized Incremental Calculation (O(1)):**
|
||||
Unlike basic implementations, this indicator employs an intelligent incremental algorithm.
|
||||
@@ -74,7 +81,7 @@ $\text{TEMA}_t = (3 \times \text{EMA}_1) - (3 \times \text{EMA}_2) + \text{EMA}_
|
||||
## 4. Parameters
|
||||
|
||||
* **Period (`InpPeriod`):** The lookback period for the moving average calculation.
|
||||
* **MA Type (`InpMAType`):** Select from SMA, EMA, SMMA, LWMA, TMA, DEMA, TEMA.
|
||||
* **MA Type (`InpMAType`):** Select from SMA, EMA, SMMA, LWMA, TMA, DEMA, TEMA, WMA, VWMA.
|
||||
* **Applied Price (`InpSourcePrice`):** The source price (Standard or Heikin Ashi).
|
||||
|
||||
## 5. Usage and Interpretation
|
||||
@@ -83,4 +90,6 @@ $\text{TEMA}_t = (3 \times \text{EMA}_1) - (3 \times \text{EMA}_2) + \text{EMA}_
|
||||
* **Bullish:** Price > MA and MA sloping up.
|
||||
* **Bearish:** Price < MA and MA sloping down.
|
||||
* **Dynamic Support/Resistance:** The MA line often acts as a bouncing point for price during trends.
|
||||
* **Crossovers:** Using two MAs (Fast and Slow) to generate buy/sell signals (Golden Cross / Death Cross).
|
||||
* **Volume Confirmation (VWMA vs SMA):**
|
||||
* When **VWMA is above SMA**, it indicates that volume has been higher on bullish closed bars (high institutional demand).
|
||||
* When **VWMA is below SMA**, it signifies that volume is backing bearish developments.
|
||||
Reference in New Issue
Block a user