The moving average slope function is an extremely simple indicator and indicates several useful things:
– Direction of the given moving average, thus trend
– Gradient or slope of the given moving average thus momentum or power of the recent price action
– probability of continuation of price action.
This is a simple function which can prove to be valuable for algorithmic or manual trading. Use in conjunction with other indicators to find entries; or use as a filter to prevent bad entries. It’s best used with slower moving exponential averages but can also be used with a combination of averages. This can be considered as a building block for more complex indicators and trading systems.
The histogram will give you a easy representation of acceleration or deceleration of a move. Oftentimes I see system code that checks whether a moving average is going up or going down in relation to its last few bars. This tool is more granular and will also allow you to test for when an average is curving off, or losing steam. That will allow you to enter a move sooner.
A change in direction of the histogram back towards the zero line indicates the potential curving off of the underlining moving average and thus a reversal is more likely. In conjunction with other indicators, it may help to get into a move earlier than otherwise.
Zero crossings of the histogram suggest momentum is picking up in the direction of the crossing. Zero crossings become more significant if the previous wave was above a given threshold. It is up to you to set that threshold; low volatility crossings should be ignored.
Units are in points expressed as basis points per candle. If the chart was on a one-minute time frame and the histogram was showing +1, this would mean that the moving average was rising by one point per minute. A 30-minute time frame showing -3 would mean the moving average was falling by 6 basis points per hour.
– maPeriod :: the moving average period. This is normally set at 200 by defailt
– maType :: the moving average method. Expotential average is the default
// Moving Average Slope
// Author: Maz @ prorealcode.com
// maPeriod = 200 // Moving Average Period
// maType = 1 // Moving Average function - 1: exponential
ma = average[maPeriod, maType](customClose)
slope = ma - ma
// -- Colour management -----
if slope > 0 then
if slope > slope then
g = 255
r = 0
elsif slope < slope then
g = 200
r = 0
elsif slope < 0 then
if slope < slope then
r = 255
g = 0
elsif slope > slope then
r = 200
g = 0
return slope coloured(r, g, 10) style(histogram, 1) as "Moving Average Slope"
Please reach out if there are any questions.
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.ProRealTime ITF files and other attachments :