Cycle Adaptive Bollinger
A fixed-period Bollinger Band assumes the market's rhythm matches whatever constant was typed in. When it does not, the basis average and the standard deviation both end up blending bars from more than one cycle phase, which is exactly what makes band width comparisons unreliable across changing regimes - a "squeeze" on one day is not directly comparable to a "squeeze" measured a month later if the underlying cycle length has drifted. This version measures the dominant cycle every bar using the same Hilbert transform approach documented in CycleAdaptiveRsi.mq4 elsewhere in this catalogue: a quadrature filter turns the median price into an in-phase and quadrature pair, a homodyne discriminator reads the phase rotation rate between successive bars, and that rate converts into a period in bars, smoothed and clamped between InpMinPeriod and InpMaxPeriod so a mis-measured reading cannot collapse the window or send it to an absurd length. The Bollinger basis and standard deviation are then recomputed as a plain windowed statistic over that adaptive length each bar - not an incremental running average, since the window length itself changes bar to bar, the same way a Wilder-style running smooth would silently drift across a period change. Notes and limitations - The Hilbert transform estimator needs roughly InpMaxPeriod + 12 bars of history before it produces a meaningful reading; earlier bars are seeded flat and should not be read as signal. - The dominant-cycle estimate itself can lag a genuine regime change by a handful of bars, the same limitation any adaptive-period technique carries - it measures what has been happening, not what is about to. - Non-repainting: every bar's basis, band, and cycle estimate are computed only from that bar's own completed history and never revised afterward.
Indicator · MT5 · v1.0 · Free
About Cycle Adaptive Bollinger
Cycle Adaptive Bollinger is an indicator for MetaTrader 5. It has 3 settings, such as Min period, Max period and Deviations. MQL source code included.
Files in the download: CycleAdaptiveBollinger.ex5, CycleAdaptiveBollinger.mq5, CycleAdaptiveBollinger.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Min period | 8 | Floor on the measured dominant cycle, in bars |
| Max period | 60 | Ceiling on the measured dominant cycle, in bars |
| Deviations | 2.0 | Standard deviation multiplier for the band offset |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Bollinger Bands · MT5 Indicator · MQL5 Source Code