Chapter 2 - SMAs, EMAs or Other?
Ok, let’s just focus on the basics.
Ok, let’s just focus on the basics.
- Simple moving averages (SMA) are nonrecursive filters, where all the coefficients equal one divided by the number of elements in the filter
- When time advances by one bar, the fractional part of the oldest data is discarded and the newest data is added; this is the ‘moving’ part
- "As simple as it gets!"
- It’s a bit like a ‘window’ that passes across a data stream
- An impulse
- A theoretical data object
- Zero width and infinite height
- Used to assess the filter transfer response
- Think of it as the clapper in bell
- The bell is the transfer response; the ringing is the output
- The ringing is the impulse response
- You can approximate an impulse as a data stream with a value only at one point, and zeros in all other data samples
- Sliding an SMA window across the impulse data stream, filter will only have an output when the impulse falls within the filter window
- This makes it a special case of the FIR (finite impulse response) filter.(ok, but what does this have to do with anything??)
- The SMA is synonymous with finding a best-fitting straight line to the data, when lag is disregarded. Ehlers finds this ‘fascinating’.
- SMA lag is (N-1)/2
- Critical period
- Of a filter output is the frequency at which the output power of the filter is ˝ the power of the input wave
- The critical period of an SMA is approximately 2x its length; which defines its ‘pass band’
EMAs vs. WMAs
- EMA should always be written as EMA = alpha * Input + (1- alpha) * EMA[1] to avoid computational errors; where alpha = the value of the first bar
- Ehlers is fond of saying things like “It is instructive to examine the EMA response to a step function.” But is it really? Instructive of what?
- Ehlers disparages the WMA (weighted moving average) as the invention of a trader who didn’t understand that the WMA has poor rejection in its transfer response; which is to say it’s laggy and offers no benefits over an EMA
Median filters
- A median filter simply picks the middle value of a sample set of data after the samples have.
Median filters are best used when the data contains impulsive noise or when there are wild variations. Smoothing volume data is a good application for a median filter.
Should I now test an EMA vs a WMA? I'm inclined not to as there is much testing to be done in later chapters. Also I don't really care about the minute advantages of one moving average over another. They are, as Ehlers would admit, all just filters of varying characters and predictive of nothing.
3