# Pascal Weighted Moving Average (Pascal WMA) Professional
## 1. Summary (Introduction)
The Pascal Weighted Moving Average (Pascal WMA) is a unique type of weighted moving average that derives its weights from the coefficients of Pascal's triangle. This produces a set of weights that are perfectly symmetrical and follow a smooth, bell-shaped (Gaussian-like) curve.
The Pascal WMA is a **symmetrical smoothing filter**. Its primary purpose is not to follow trends with minimal lag, but to provide an exceptionally smooth and stable representation of the market's central tendency.
Our `PascalWMA_Pro` implementation is a unified, professional version that allows the calculation to be based on either **standard** or **Heikin Ashi** price data, selectable from a single input parameter.
## 2. Mathematical Foundations and Calculation Logic
The Pascal WMA calculates a weighted average where the weights are the binomial coefficients found in a row of Pascal's triangle.
### Required Components
* **Period (N):** The lookback period for the moving average.
* **Source Price:** The price series used for calculation.
### Calculation Steps (Algorithm)
1.**Generate Pascal Weights:** For a given period `N`, the weights are the coefficients of the binomial expansion of $(x+y)^{N-1}$. The `k`-th weight is calculated using the combination formula:
* **`CPascalWMACalculator_HA`**: A child class that inherits all the complex logic and only overrides the initial data preparation step to use smoothed Heikin Ashi prices as its input.
* **Robust Weight Generation:** The Pascal's triangle coefficients are calculated only once during initialization using an iterative method to prevent integer overflow for large periods.
The Pascal WMA should be interpreted as a **high-quality smoothing filter and a "mean" or "center of gravity" line**, not as a traditional trend-following moving average.
* **Noise Reduction and Trend Clarity:** The primary use is to filter out market noise and provide a clearer picture of the underlying price movement.
* **Mean Reversion Signals:** The line acts as a "magnet" for the price. When the price moves significantly away from the Pascal WMA, it can be considered over-extended, increasing the probability of a reversion back towards the line.
* **Caution:** Due to its inherent nature as a centered, smoothing filter, the Pascal WMA will always lag the price. It should **not** be used for fast crossover signals. Its strength lies in its exceptional smoothness and its ability to define the market's equilibrium point.