Moving Average Envelopes
The Moving Average Envelope functions compute a pair of data bands that envelope a moving average of the input data values.
Each data band is positioned a percentage-based magnitude away from the moving average line. The average line can be calculated using a simple moving average or an exponential moving average. Applications of the Moving Average Envelope functions include indication of overbought/oversold conditions and price trends for a security.
The mathematical expressions being calculated are as follows:
Upper = Moving Average * (1 + K) Lower = Moving Average * (1 – K)
Where K is the indicated percentage-based factor.
The MOVAVGEVPUPPER and MOVAVGEVPLOWER functions require the following input:
- d0 - Input data values - The set of data values for which the MOVAVGEVPUPPER and MOVAVGEVPLOWER formulas are calculated.
The MOVAVGEVPUPPER and MOVAVGEVPLOWER functions require the following parameters.
- s0 - Moving Average Type - The type of moving average to use in the calculation. Valid values are:
- 0 : Simple Moving Average (default)
- 1 : Exponential Moving Average
- s1 - Period - The number of time periods to use in the calculation. Default value is 10.
- s2 - Envelope factor - The factor used to shift the bands away from the simple moving average. Default value is 2.5.
- Alignment (Optional) – Hierarchy placeholder to be used as the alignment axis.
The MOVAVGEVPUPPER function generates the following output:
- Upper Envelope - The Upper Envelope result set.
The MOVAVGEVPLOWER function generates the following output:
- Lower Envelope - The Lower Envelope result set.