AIS Lehmer Moving Average
- Indicators
- Aleksej Poljakov
- Version: 1.0
- Activations: 15
The Lehmer mean can be considered as a window function, the weight coefficients of which depend on the values of the variables used in the calculation. This average is non-linear because exponentiation is used in its calculation.
The characteristics of the indicator depend on two parameters:
- iPeriod - indicator period, valid value is greater than or equal to 2;
- iPower - exponent, which is used when calculating indicator values. Valid range is -32768 to 32767
With iPower = 0 we get the harmonic mean,
with iPower = 1 - arithmetic mean,
and for iPower = 2, the counterharmonic mean.
With a large exponent, the Lehmer mean highlights the maximum boundary of the time series. And with negative exponents, the minima are emphasized. Due to this property, the Lehmer mean can be used both for smoothing the time series and for constructing channels.
The first picture shows a channel calculated using Close prices with exponents of +500 and -500.
The second picture shows the same channel with iPower = +1000 and -1000.
In the third and fourth figures, Lehmer's mean is applied to the High and Low prices at +/- 1000 and +/- 5000.