General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# How can you calculate the slope of a moving average?

Discussion in 'Trading' started by Sam Mcgee, Oct 24, 2003.

1. ### Sam Mcgee

The formula for a simple moving average for 10 bars is simply the total of the last 10 closing prices divided by 10. Would anyone know how you could calculate the slope of that moving average? I hope I don't have to relearn all the calculus I did 25 years ago. It was hard enough already way back then. I suppose I could try to look up one of my old math teachers....that is if they're still alive.

2. ### Lobster

The slope is of course relative. But once you have determined the factor k that works best for you, the slope would equal k * ( currentSMA - previousSMA )

3. ### TriPack

Slope is rise over run.

So if you have two prices 1020.00 and 1020.5 right next to each other and in that order and your barspacing is 1.

(1020.5-1020.0)/1 = .5

At least that's what I recall from my algebra class.

4. ### Sam Mcgee

Thanks guys, I forgot that it was that simple, rise over run. I should have remembered that and the friction coefficient of ice covered shingles before I fell off the roof last year.

5. ### mr_minty

yeah. be careful when using slope..like lobster said, the slope is relative...meaning it is NOT invariant to changes in scale...perhaps trend lines of the MA would help u out more because the line drawn by the intersection of two or more points are invariant under changes of scale....

6. ### inandlong

But 4 over 2 is the same regardless of chart scale. Increasing or decreasing the spacing between units doesn't change the value of the units.

7. ### Lobster

That's true, but what mr_minty means is that some people like to think of slope in degrees. A 45 degree slope could be a rise of one point per minute, but it could just as well be one point per hour, depending on how you scale your chart. And of course it is even more complicated if you don't have time (but rather ticks or something else) on the horizontal axis.

8. ### ArchAngel

You might also want to consider using a linear regression of the moving average values over a selected # of periods - it might give you a better slope (i.e., trend) indicator than a simple (Vn - V(n-m))/m

Try comparing a moving liinear regression line slope to the simple (rise/time) moving line and see which one gives you the kind of information you're looking for.

Slope/trend is also only one factor - slope is like velocity (direction and speed), but also consider looking at acceleration (the rate of change of the slope).

9. ### inandlong

I see, thanks Lobster.

ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES: