Geometric Mean Average
The geometric mean of a set of positive numbers is the nth root of their product, computed here as exp of the average of their natural logs to avoid overflow on long windows. For a price series it answers a slightly different question than an ordinary moving average: an arithmetic mean treats a move from 1.1000 to 1.1010 the same as a move from 1.2000 to 1.2010, while a geometric mean treats both as the same proportional change. On typical FX ranges the two are close, but they are never identical unless every price in the window is exactly equal - by the AM-GM inequality the geometric mean is always less than or equal to the arithmetic mean for positive values. That gap is not noise; it grows with the dispersion of prices inside the window. A window with prices bunched tightly together produces a small gap; a window spanning a wide range - a volatile stretch, or a strong one-directional run - produces a larger one. The second buffer plots this gap (arithmetic minus geometric) directly, giving a cheap, already-computed dispersion reading alongside the smoothing line itself, at no extra cost beyond the mean that was being calculated anyway. The geometric mean line is computed independently at every bar straight from the raw prices in its window - it is not a recursive filter and carries no memory of earlier bars beyond what falls inside the current window, so it responds and settles exactly like a plain SMA of the same period, just riding slightly below it. Notes and limitations - Requires every price in the window to be strictly positive; this is never a practical concern for FX/CFD quotes, but a window that somehow contains a non-positive value is skipped (plotted empty) rather than crashing MathLog. - Needs InpPeriod bars of history before it starts plotting. - Not recursive, so it never repaints once a bar has closed - each value depends only on that bar's own fixed window of past prices.
Indicator · MT4 · v1.0 · Free
About Geometric Mean Average
Geometric Mean Average is an indicator for MetaTrader 4. It has 2 settings, such as Period and Applied price. MQL source code included.
Files in the download: GeometricMeanMa.ex4, GeometricMeanMa.mq4, GeometricMeanMa.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Period | 14 | Averaging period |
| Applied price | PRICE_CLOSE | Applied price |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · MT4 Indicator · MQL4 Source Code