The Double Exponential Moving Average (DEMA) is a technical indicator that aims to reduce the lag associated with traditional moving averages, providing a faster response to changes in price data. It is particularly useful in trading systems to detect early signals of market trends.
DEMA[N](price)
Where N represents the number of periods over which the average is calculated, and price indicates the price type (e.g., close, open, high, low).
i1 = DEMA[10](open)
a = 0
WHILE Open[1] < i1 DO
a = a + 1
WEND
RETURN a
This example calculates the 10-period DEMA of the opening prices. It then counts how many consecutive periods the previous open price is less than the DEMA value.
The DEMA indicator is more responsive than a simple moving average or an EMA, making it advantageous for traders who need to react quickly to price changes. However, its sensitivity can also lead to increased noise, which might generate false signals. It is often used in conjunction with other indicators like the MACD or stochastic oscillator to confirm trends and refine trading strategies.