Skip to content
All library documents

Adaptive Lookback Averages Based on Market Swing Frequency

Article MQL5 code base

Summary

The document explains an adaptive lookback method for moving averages. It estimates a variable period by counting how many price bars are needed for a chosen number of swing highs or lows to form, then dividing the bar count by the swing count and rounding. A speed parameter adjusts how quickly the resulting average responds. The method is presented for simple, exponential, smoothed, and linear weighted averages.

The described behavior is a longer lookback in calmer or trending conditions and a shorter one in choppy, volatile conditions, where swings occur more frequently. The source suggests this design may suit short-term or counter-trend systems that need faster signals, while warning that trend-following systems could be more vulnerable to whipsaws. It gives a conceptual explanation, not empirical tests, and does not specify enough implementation details to establish profitability or robustness.

Key ideas

  • The adaptive period is estimated from the bar frequency of a chosen number of price swings.
  • A speed parameter modifies the responsiveness of the calculated lookback.
  • The method shortens its lookback in choppy, volatile markets and lengthens it in calmer or trending markets.
  • It can modify several common moving average types.
  • The document presents a potential use for short-term and counter-trend systems but provides no performance tests.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.