Loading…

Multi Pole Gaussian Filter

A moving average's smoothness and its lag are locked together by the window length alone - the only way to smooth more is to average more bars, which adds lag in direct proportion. Ehlers' Gaussian filter family decouples that trade-off from a plain window length by using a single alpha coefficient, derived from the desired cutoff period and a chosen pole count N, fed through binomial feedback taps built from Pascal's triangle (the same expansion that generates (1-alpha)^N). Each additional pole steepens the filter's rolloff near the cutoff - it rejects more of the noise close to the cutoff frequency - while leaving the cutoff itself in the same place, at the cost of a predictable extra bar or two of lag per pole rather than the linear lag growth a longer moving average window would cost for the same noise rejection. This file exposes the pole count as a direct input from one to four, so the trade-off between rolloff steepness and lag is something a trader dials explicitly at a fixed cutoff period, rather than something implied indirectly by picking a longer or shorter moving-average window. Notes and limitations - This is a smoothing filter, not a signal generator on its own - it estimates a noise-reduced price line; entries and exits are left to the trader's own rules around price-versus-filter behaviour or a cross against a second instance at a different period/pole count. - The first InpPoles bars after the indicator loads are seeded directly from price rather than the recursive formula, since there is no prior filter output yet for those bars to recurse from. - Raising the pole count at a fixed period adds real lag - it is not a free steadier line. Comparing InpPoles = 1 against InpPoles = 4 at the same InpPeriod on the same chart makes that cost directly visible. - Never repaints: every plotted value for a closed bar is final.

Indicator · MT5 · v1.0 · Free

About Multi Pole Gaussian Filter

Multi Pole Gaussian Filter is an indicator for MetaTrader 5. It has 2 settings, such as Period and Poles. MQL source code included.

Files in the download: GaussianFilterMa.ex5, GaussianFilterMa.mq5, GaussianFilterMa.txt.

Settings

SettingDefaultWhat it does
Period14Filter cutoff period in bars
Poles2Number of poles, 1 to 4 - more poles = steeper rolloff, more lag

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria