Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
The Smoothed Moving Average or SMMA - How to Avoid It
I had recently stumbled upon the smoothed moving average or SMMA, which is used by many other indicators such as shaded moving averages, the Supertrend and channel indicators. I had then simplified the code , but the indicator left me confused, as I had no idea, what it is needed for.
The code I found on the forum has the following core
which I changed into
This looks interesting, but it is not easy to see what it is actually doing. So I searched the Internet to get more information and found that there is not a single version of the SMMA but that two different versions exist. Let us call the the 2 versions “Useless” and “Simple”.
The Useless SMMA
Taking a look at the SMMA proudly presented by WealthLab, I found the following formula, here translated to NinjaScript
This formula clearly points to an exponential moving average with the known formula EMA = (k-1)/k * EMA[1] + 1/k * Price,
where k = 2/(period+1).
And indeed, the SMMA when used with a Period n returns the same result as an EMA, when used with a period 2*n – 1. For example, the following equalities apply:
This means that this SMMA version is indeed completely useless, as it returns the same results as an EMA. It just uses a false period and cannot be fine tuned to display EMAs with even periods. This is an indicator for the garbage bin. You will find this version of the SMMA for WealthLab, Metastock, MetaTrader 5, FXCM
The simple version of the SMMA is similar to the useless one, the NinjaScript formula for the core is
which comes close to the useless SMA, which uses SMMA(Period)[1] in place of SMA(Period)[1] for the first term of the expression above.
This moving average is easier to understand. It takes the previous value of the SMA and then adds a correctional term, which is 1/Period multiplied with the difference of current Price and the previous value of the SMMA. As it always starts calculating by using last period’s simple moving average, it produces a smoothed moving average, which closely tracks the SMA. This is a modest achievment, but still better than no achievement. A chart showing a simple moving average and the two versions of SMMA is attached.
The SMMA version, which I found on Big Mike's Forum is neither the Useless nor the Simple SMMA, but it is a variation of the Useless SMMA. Let us have a look at the code again:
The mechanics are similar as the definition of the Useless SMA, but to calculate smma1, which is the current value of the smma, the term prevsmma1 is deducted twice, and the term Input[0] is added twice, once directly and once as part of sum1. Whether this was intentional or by mistake, it creates a new breed of SMMA, which is slightly different compared to the original version and which I will refer to as the Forum SMMA. In my version of the formula this translates into the additional term shown in bold below
This term represents a fraction 1/Period of the difference between SMMA[1] and SMMA[2]. The outcome is a moving average which closely tracks the EMA, but has some additional lag. Actually I do not have any argument to use the Forum SMMA in place of the EMA, so it looks redundant to me as well.
If there is anybody around, who can explain to me, whether the error term is intentional or erroneous, I would like to know. Practically, I have no use for the additional lag introduced.
Conclusions:
All SMMAs I have found have either little practical value, or even worse are redundant or misleading. I do not see any practical value for trading and have no use for them and will not further waste my time with them.
NinjaTrader has a nice feature allowing you delete useless and redundant indicators. I will also modify my other indicators which produce channels or crosses from various moving averages, not to call the SMMA. There is no value added, but value reduced. If anyone has used the Forum SMMA until now, I recommend using the EMA instead.
Due to its additional lag, the Forum SMMA can better be approximated by an EMA with a slightly increased period, so you would replace the Forum SMMA(8) with an EMA(17), compare this with the EMA(15), which is the identical replacement for the SMMA(8).
All SMMAs belong to the Garbage Bin. They were just created to waste your time!
I thought that looked familiar... In fact the indicator I've posted as jhlMMA essentially is:
class MMA : JHL.Utility.EMA {
public MMA(int periods) : base(Math.Max(1, periods) * 2 - 1)
{
}
}
While I agree it's really quite useless, it is actually the Welles Wilder MA method which makes it an essential ingredient in other indicators such as ADX.
From my description in the download section:
Wikipedia calls this a 'Modified Moving Average'. Traders may know it as Welles Wilder's Moving Average, as it is the averaging method used in many of his indicators.
It's conceptually simpler than an EMA, the basic formula being:
average = (newValue + priorAverage * (n - 1)) / n
However, for any number of periods 'n', the outcome is identical to EMA(2 * n - 1).
While I agree it's really quite useless, it is actually the Welles Wilder MA method which makes it an essential ingredient in other indicators such as ADX.
From my description in the download section:
Wikipedia calls this a 'Modified Moving Average'. Traders may know it as Welles Wilder's Moving Average, as it is the averaging method used in many of his indicators.
It's conceptually simpler than an EMA, the basic formula being:
average = (newValue + priorAverage * (n - 1)) / n
However, for any number of periods 'n', the outcome is identical to EMA(2 * n - 1).
Thanks for this comment. The Useless SMMA is indeed identical with Welles Wilder's average. The point is that Welles Wilder was not really interested in different types of moving averages, but from a practical point of view he looked for a method allowing him
-> to make as little calculations as possible, as he did not have a PC performing this task back in the 70s, and the exponential smoothing is ideal as you just use the prior value of the average and current price to calculate the new value
-> use an average that does not bite good-bye when the first element drops out as does the SMA
With the article by Jack K.Hutson "Filter Price Data: Moving Averages versus Exponential Moving Averages". which appeared in the May/June 1984 issue of Technical Analysis of Stocks and Commodities, it was shown that the equivalent of a simple moving average with the period n was obtained by using a smoothing constant 2/(n+1) for the exponential smoothing. From there on, the current definition of the period of an EMA was used and now is the standard for EMAs.
So there is no need to go back to an alternative definition for the period as used by Welles Wilder in the 70s for practical purposes. All indicators that use Wilder's smoothing can alternatively use an EMA.
EMA uses a recursive formula. The period in the EMA doesn't make sense since it uses all of the bars to calculate the current value although the early bars have less effect. A generalized EMA should be:
EMA uses a recursive formula. The period in the EMA doesn't make sense since it uses all of the bars to calculate the current value although the early bars have less effect. A generalized EMA should be:
where 0 < k < 1 is a constant, it can be any constant between 0 and 1.
DiNapoli used this generalized EMA to construct his own version of MACD (DiNapoli MACD).
DiNapoli reinvented everything, which was already invented and renamed it after DiNapoli .....
The only thing you need to do, is allow for broken periods greater than 1 . I have attached a generic EMA indicator, which allows you to enter fractional periods. The chart shows my new EMA Crossover System, which uses an EMA (38.3) and an EMA (12.7).
Elite Membership required to download: GenericEMA.zip
I am searching about that SMMA you talked about here. In particular the version you named "The Simple SMMA", even if it seems useless I have a strategy, in which it have a part, that I'm migrating to NT from another platform. If you kindly can share that indicator I really appreciate.