An exponential moving average (EMA) is a type of moving average that places a greater weight and significance on the most recent data points.
An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average, which applies an equal weight to all observations in the period.
Lines that were a certain amount above and below the moving average form the envelopes.
movav = prev * (1.0 – smoothfactor) + newdata * smoothfactor where smoothfactor =1- 2 / (1 + period)
Top or Upper value of the band calculated as ema*(100+perc)/100
Bottom or Lower value of the band calculated as ema*(100-perc)/100
How to use:
The EMA is a moving average that places a greater weight and significance on the most recent data points. Like all moving averages, this technical indicator is used to produce buy and sell signals based on crossovers and divergences from the historical average. Traders often use several different EMA lengths, such as 10-day, 50-day, and 200-day moving averages.
- When the price crosses above the upper band, it indicates that the current price is greater than the average of the defined period, hence the market is in an upward trend
- When the price crosses down the lower band, it indicates that the current price is lower than the average of the defined period, hence the market is in a downward trend.
Building On Mudrex:
As discussed above, lets first write our entry/exit conditions so that we know what to do:
BUY: When price crosses up the upper band.
SELL: When price crosses down the lower band.
Final Strategy: The final strategy on Mudrex looks like this
We can now run a quick back-test to see how our strategy performs.