Feb 13

This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


If I was as smart as Prospectus or Richard, I may or may not participate in this ET thread. I found it interesting, and hopefully, one of these rocket scientist or level 3 programmers, can glean something from it to make us all rich.

To construct a 20 day exponential moving average you must first construct a 20 day simple moving average. This simple moving average is the starting point for the exponential moving average. Assume that the simple moving average value for day 20 is 42; the simple moving average value for day 21 is 43; and the simple moving average value for day 21 is 44. We then subtract the day 20 moving average value from day 21 simple moving average value and get a difference of 1.00. This value (1.00) is multiplied by an exponent. In this case, the exponent is .1. We then add .1 to the simple moving average value of day 20. The exponential moving average value of day 20 now becomes 42.100. And this goes on indefinitely. To calculate the exponent, divide 2 by the time period. In our case, we divided 2 by 20 to arrive at .1.

I think a psychologist would have a field day, observing some of the ridiculous comments here from people who are probably compensating for their poor performance in the stock market by trying to impress their fellow traders by bluffing that they have some scientific understanding of what they do. Unless you have a math/scientific background, please do not comment on this thread.

A moving average of length n of say a time series (like prices of a stock etc.) is computed as xbar = (Sum of n consecutive elements)/n. That means you take only into account n elements, no more, no less. The elements are all equally weighted with weight 1, it is possible to give each element a different weight.

The purpose of a moving average is to smooth a time series, ie. to replace each member by a moving average of its neighbours. Say you take a length of 5 for the ma, then an element xn is replaced by ((xn-2) + (xn-1) + xn + (xn+1) + (xn+2))/5. That is you need to know members xn+1 and xn+2 before you may replace xn by its ma. And that is the lag of the ma. Smoothness is achieved in two ways: by the choice of length and by the choice of the weights for each x. Giving far out members, like the xn+2 in the above example, less weigth, say you multiply them by 0.5 only instead of 1, will make the ma more responsive, using a longer length or a smaller multiplier for the recent members will make it smoother.

The use of a ma in Technical analysis is less to smooth a time series, but to implement a trading method, you do not replace a member xn by its ma in the way described above, but you replace xn by ((xn-4)+(xn-3)+(xn-2)+(xn-1)+xn)/5. That is you shift the ma to the right. A TA program, like Metastock, does have an option to left-shift the ma, that is to plot it correctly. Do this and you will graphically understand lag.

The exponential ma is computed as Close*percentage + (previous EMA) * (1-percentage), percentage ranging from 0.01 to 1. Starting value is Close (or whatever value you use). That is an EMA always uses *all* previous data, weighted, while a simple ma only uses data as described by its length. So there really is no equivalence between percentage used in an EMA and length (or number of periods) used in a SMA.

That said, for practical purposes the equivalence may be computed as already quoted in previous posts. Prices are not quoted infinitesimal, that is you do not pay 78.234598122…. $ for a stock but 78.23 $ so prices are “quantized” and that is the reason the formula makes sense. The farther you get away from a certain value the less its contribution to the current value of an EMA will be till it drops below the threshold.

An SMA is a Fininte Impulse Response (FIR) filter. The lag, or delay, of any end-to-end symmetric (or anti-symmetric) FIR is approximately one half the filter length. In the case of a time series SMA, the lag of an SMA is exactly (N-1)/2. So a 7-bar SMA has a lag of exactly 3 bars. This lag is referred to as the “group delay” in engineering terms. [Group delay is defined as the rate of change of phase with respect to angular frequency.]

Regarding the 2/(N+1) for the period in the alpha calculation of an EMA, while I don’t know the origin of the formula, the reason the MA is called “exponential” (to answer one of your original questions) is the way an EMA’s transfer response decays is in amplitude over N bars. [e.g. The most recent value of the time series is weighted by alpha, the next most recent value is weighted by alpha*(1-alpha), the next value by alpha*(1-alpha)^2 .... the Nth value is weighted by alpha*(1-alpha)^N.]

Note that for any given period N, the weight of alpha*(1-alpha)^M where M>N, the weighting affect on the MA approaches zero as M increases, hence for practical purposes, the formula of alpha=2/(N+1) generally describes the affect of the EMA weight N periods back.

The concept of “period” in an EMA is approximate, unlike an SMA or WMA where it is exact. MA’s get more interesting when you starting looking at Digital Signal Processing, when you start looking at phase changes. SMA’s and WMA’s have linear phase lag defined by the fixed period, but EMA’s, due to the recursive nature of its calculation, has a nonlinear phase lag.


This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


May 4

This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


This is a follow up on Tapeworm’s PMA post from yesterday. This is a short term trading technique that combines PMA’s with a pattern that LBR calls the “anti” in “Street Smarts”. The lower indicator is a 7 period %K smoothed with 4, and a 10 period %D. You will find this pattern occurs quite often, but it does have some subtleties to it.

Mainly, do not countertrend trade this pattern, always go in the direction of the current trend, using the slope of the %D for the direction of the trade.

In Tradestation I set alerts when this pattern occurs. The list posted on this site called “Top Stocks to Daytrade” will normally work well on this setup.

The PMA’s help to maintain the trade. Once you are in, use the PMA’s as an exit, though the %K can alert you to an early need to exit.

If you look at the previous day, this would not have worked as well, though there were two 25 cents moves even though there was chop, as long as you used the %D slope and the PMA’s.

The best one I caught today was on UTX:

UTMA anti pma


This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


May 2

This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


There have been a couple of questions at Wallstreak about PMAs. Mainly, what are they? I first came across this idea in Mark Fisher’s, The Logical Trader. They are calculated using the average of the high, low, and close of each bar. Richard uses the average of the high and low which seems to produce very similar lines. The reason I use PMAs, especially on intra day charts, is to minimize the importance of the bar’s close. On a fast chart such as the 5′, the close is an arbitrary number. That same reasoning is what keeps me from putting too much importance on any individual candle.

As Fisher points out in his book, don’t focus on moving averages as barriers to be crossed, look at the slope of the pivot moving average line. A change in slope is an important indication of a change in perception in the market. He goes over specific strategies and periods that he uses which I won’t get into here. Instead I will focus on how I use them, and why I came up with this approach.

Like many traders, I have a few strategies. Some work great in rangebound markets — variations of divergence plays. Others work great when the market is trending. My only problem was that I had a hard time switching strategies. I would recognize a divergence between momentum and price, for example, and go short only to be stopped out. On days when I recognized the correct phase of the market, I would make money. On the other days, I would take multiple stops. To add insult to injury, after being stopped out of a divergence trade, I would have to watch the market run away without me. Psychologically, it wasn’t a good place.

Now I focus on finding intra day trends. I don’t trade counter-trend strategies at all. However, to make it work financially, I had to find a way to hold onto my winners. There are a few pieces to that puzzle, but PMAs have helped immensely.

I’m posting a chart of yesterday’s crude action, because it illustrates quite well how I use the PMAs. I made three trades yesterday. I scratched the first trade, because I didn’t like the price action, and wasn’t getting the follow through expected. The next two trades are highlighted. Both solid blue thick lines mark important points on the chart for each trade. They were wide range bars that sold off on heavy volume. That was not my signal for entry, but to watch closely for a place to get short.

After each bar, crude formed a bear flag. I went short on a breakdown from each channel. The 1st trade marked resulted in a 40 cent gain, and the 2nd was for 85 cents. I actually trade the QM, because of the lower multiplier, but trade off the CL which is what I’m posting here. The CL is the dog that wags the QM’s tail.

The PMAs were not used for entry on either trade. I made the lines thicker, so they are able to be seen. The white line is the 5, the purple is the 8, and the black line is the 13. As you can see on the chart that each of these lines converged just before bear flags broke to the downside. Once I initiated entry, I was anticipating a quick resumption of the trend. As prices started falling what I wanted to see was the PMAs spreading out. This indicates an acceleration of the trend. I covered the 1st trade when it was retesting the lows of the day. It formed a hammer on heavy volume, so that was a clue to exit. However, it formed another bear flag. After I was short the 2nd time, there was about 30 minutes left in the crude session. As you can see the bands spread out nicely, and even the 5 pma never came close to even turning back up. When I get a nice solid gain, and they PMAs are separating, I have more confidence to hold onto my trade. It helps me not to get shaken out of a great trade. I rely less on any individual candlestick at this point. I’m watching the bollinger bands, hourly support/resistance, standard moving averages on the daily, the clock, and my PMAs to determine if its time to exit. On a strong trend, I have found that using the center band (13 pma) is often a good place to trail my stop. Its just one minor tool that I use to determine the health, or strength of a trade that I’m in.

5207.jpg5207.jpg


This post was contributed by a guest author, and does not necessarily reflect the views of Richard or MovetheMarkets.com


Mar 28

I’m thinking about doing a series of posts where I address what I feel are the most common misconceptions among new (and even established) traders. I see these again and again when reading books and blogs. I feel kinda funny using that angle, since I’m not a wise (or filthy rich) trading guru.

But, I do have strong opinions, and a website… so… here’s the first article :-)

Read the rest of this entry »