The Smoothed Moving Average or SMMA - How to Avoid It - NinjaTrader Programming | futures io social day trading
futures io futures trading


The Smoothed Moving Average or SMMA - How to Avoid It
Updated: Views / Replies:14,034 / 12
Created: by Fat Tails Attachments:6

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 6  
 
Thread Tools Search this Thread
 

The Smoothed Moving Average or SMMA - How to Avoid It

  #1 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,600 received
Forum Reputation: Legendary

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
 
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
The Smoothed Moving Average or SMMA - How to Avoid It-es-03-11-15-min-16_02_2011-smma.jpg  

Last edited by Fat Tails; February 16th, 2011 at 03:00 PM.
Reply With Quote
The following 16 users say Thank You to Fat Tails for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,600 received
Forum Reputation: Legendary

The Forum SMMA is Different


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
The Smoothed Moving Average or SMMA - How to Avoid It-es-03-11-15-min-16_02_2011-forum-smma.jpg  
Reply With Quote
The following 5 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 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).

Reply With Quote
The following 6 users say Thank You to fluxsmith for this post:
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,600 received
Forum Reputation: Legendary


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.


Last edited by Fat Tails; February 17th, 2011 at 06:22 AM.
Reply With Quote
The following 5 users say Thank You to Fat Tails for this post:
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 received

One down, 25,000 to go!

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
  #7 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,600 received
Forum Reputation: Legendary


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

Mike


Reply With Quote
 
  #8 (permalink)
Elite Member
San Diego, California
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: IB, OEC, Optimus, DDT
Favorite Futures: ES, ZN
 
Posts: 221 since Jun 2010
Thanks: 513 given, 157 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).

Reply With Quote
The following user says Thank You to omaha786 for this post:
 
  #9 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,600 received
Forum Reputation: Legendary

Generalizing EMA


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
The Smoothed Moving Average or SMMA - How to Avoid It-6e-03-11-15-min-16_02_2011.jpg  
Attached Files
Register to download File Type: zip GenericEMA.zip (1.9 KB, 99 views)

Last edited by Fat Tails; February 16th, 2011 at 05:19 PM.
Reply With Quote
The following 7 users say Thank You to Fat Tails for this post:
 
  #10 (permalink)
Trading Apprentice
Roma, Italia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
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

Reply



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

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Moving Average sharmas Elite Automated Trading 62 April 9th, 2012 07:44 PM
Moving average Help yiman NinjaTrader Programming 4 July 29th, 2011 09:03 AM
Moving Average of RSI Blz17 NinjaTrader Programming 6 February 12th, 2011 02:52 PM
New Moving Average arnaudlx The Elite Circle 10 January 28th, 2011 06:15 AM
Moving Average Paint Bar pchofard The Elite Circle 39 April 17th, 2010 11:30 PM


All times are GMT -4. The time now is 02:27 AM.

Copyright © 2017 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
Page generated 2017-12-12 in 0.15 seconds with 20 queries on phoenix via your IP 54.90.207.75