The Smoothed Moving Average or SMMA - How to Avoid It - futures io
futures io futures trading



The Smoothed Moving Average or SMMA - How to Avoid It


Discussion in NinjaTrader

Updated by lfxpro
      Top Posters
    1. looks_one Fat Tails with 6 posts (39 thanks)
    2. looks_two kronie with 2 posts (1 thanks)
    3. looks_3 Big Mike with 1 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one Fat Tails with 6.5 thanks per post
    2. looks_two fluxsmith with 6.0 thanks per post
    3. looks_3 Big Mike with 2.0 thanks per post
    4. looks_4 kronie with 0.5 thanks per post
    1. trending_up 21,327 views
    2. thumb_up 49 thanks given
    3. group 7 followers
    1. forum 13 replies
    2. attach_file 6 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

The Smoothed Moving Average or SMMA - How to Avoid It

(login for full post details)
  #1 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,846 since Mar 2010
Thanks: 4,238 given, 26,674 received

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
 
Code
if (FirstTickOfBar)
{
	prevsum1 = sum1;
	prevsmma1 = smma1;
}
Value.Set((prevsum1-prevsmma1+Input[0])/Period);
sum1 = prevsum1-prevsmma1+Input[0];
smma1 = (sum1-prevsmma1+Input[0])/Period;
which I changed into
 
Code
Value.Set((1-2.0/Period)*Value[1]+ (Value[2]+Input[0])/Period);
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
 
Code
Value.Set(Value[1] - Value[1]/Period + Input[0]/Period);
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:

SMMA (12) = EMA(23)
SMMA (13) = EMA(25)
SMMA (14) = EMA(27)

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

Sources:
SMMA (Smoothed Moving Average Series) - Wealth-Lab Wiki
Equis International Online Community - How to run this formula up to Metastock?
Moving Average - Help
FXCodeBase.COM: Forex Chart Indicators and Development • View topic - SMMA - Smoothed Moving Average (SMMA) [Update Aug 27 2010]
Smoothed Moving Average (SMMA) - DailyFX Forex Forum | FX Forum


The Simple SMMA

The simple version of the SMMA is similar to the useless one, the NinjaScript formula for the core is
 
Code
Value.Set (SMA(Period)[1] – Value[1]/Period + Input[0]/Period);
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.

Sources:

Investor/RT Tour - Moving Averages
Moving Average - Trends Indicators - Technical Indicators - Technical Analysis
Moving Average (MA)

Attached Thumbnails
Click image for larger version

Name:	ES 03-11 (15 Min) 16_02_2011 SMMA.jpg
Views:	701
Size:	100.7 KB
ID:	31093  
Reply With Quote
The following 17 users say Thank You to Fat Tails for this post:

Can you help answer these questions
from other members on futures io?
converting useful Pine Script into Multicharts code
EasyLanguage Programming
Historical option expirations
Brokers
Convert H Data TS to NT
NinjaTrader
Chart on TV, what platform is best for swing order entries?
Traders Hideout
Das Trader Pro
Platforms and Indicators
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,846 since Mar 2010
Thanks: 4,238 given, 26,674 received


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:

 
Code
if (FirstTickOfBar)
{
	prevsum1 = sum1;
	prevsmma1 = smma1;
}
Value.Set((prevsum1-prevsmma1+Input[0])/Period);
sum1 = prevsum1-prevsmma1+Input[0];
smma1 = (sum1-prevsmma1+Input[0])/Period;
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

 
Code
Value.Set((1-1.0/Period)*Value[1] - (Value[2] - Value[1])/Period  + Input[0])/Period);
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!

Attached Thumbnails
Click image for larger version

Name:	ES 03-11 (15 Min) 16_02_2011 Forum SMMA.jpg
Views:	297
Size:	77.7 KB
ID:	31095  
Reply With Quote
The following 6 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #4 (permalink)
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
 
Posts: 295 since May 2010
Thanks: 97 given, 321 received


Fat Tails View Post
The Useless SMMA

Taking a look at the SMMA proudly presented by WealthLab, I found the following formula, here translated to NinjaScript
 
Code
Value.Set(Value[1] - Value[1]/Period + Input[0]/Period);
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.

I thought that looked familiar... In fact the indicator I've posted as jhlMMA essentially is:
 
Code
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).

Visit my futures io Trade Journal Reply With Quote
The following 6 users say Thank You to fluxsmith for this post:
 
(login for full post details)
  #5 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,846 since Mar 2010
Thanks: 4,238 given, 26,674 received


fluxsmith View Post
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.

Reply With Quote
The following 5 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,137 since Jun 2009
Thanks: 31,801 given, 95,692 received

One down, 25,000 to go!

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #7 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,846 since Mar 2010
Thanks: 4,238 given, 26,674 received


Big Mike View Post
One down, 25,000 to go!

Mike


Reply With Quote
 
(login for full post details)
  #8 (permalink)
San Diego, California
 
Experience: Intermediate
Platform: Sierra Chart
Broker: IB, OEC, Optimus, DDT
Trading: ES, ZN
 
Posts: 221 since Jun 2010
Thanks: 512 given, 158 received

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(0) = c(0)
ema(n) = k * c(n) + (1 - k) * ema(n-1)

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).

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to omaha786 for this post:
 
(login for full post details)
  #9 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,846 since Mar 2010
Thanks: 4,238 given, 26,674 received


omaha786 View Post
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(0) = c(0)
ema(n) = k * c(n) + (1 - k) * ema(n-1)

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).

Attached Thumbnails
Click image for larger version

Name:	6E 03-11 (15 Min) 16_02_2011.jpg
Views:	463
Size:	95.9 KB
ID:	31128  
Attached Files
Register to download File Type: zip GenericEMA.zip (1.9 KB, 118 views)
Reply With Quote
The following 8 users say Thank You to Fat Tails for this post:
 
(login for full post details)
  #10 (permalink)
Roma, Italia
 
 
Posts: 1 since Mar 2013
Thanks: 0 given, 0 received


Hello Fat Tails,

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.

Best regards
Andrea

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > The Smoothed Moving Average or SMMA - How to Avoid It


March 23, 2019


Upcoming Webinars and Events
 

Bookmap

Nov TBD
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts