Moving Average Indicator is the most popular technical indicator, it provides useful informations but often it’s not sufficient.

To programming an automated trading system, many times, you need to know the slope of the moving average.

Calculing the slope is very simple, you have to compare the last Moving Average value with the precedent:

moving aveerage slope indicator formula

This is the classic formula, but we dont’ like it. Maybe only two comparation is too little and there are too many changes in the slope.

moving average slope indicator change directions

We prefer to compare more candle. As you can see, the noise decreasing.

moving average slope indicator

If you use a short moving average (less than 50-periods), you have to increase the number of bars for calculation to avoid the noise.

If you want download this indicator, choose your platform:


Two moving average slope indicator

To limit false signals, we can add another slope moving average. So we have, for example, a 20-periods Slope MA with a 40-periods Slope MA system.

Two moving average slope indicator

When both indicators have the same direction, the signal is stronger. To chart this, we could use an histogram.

double moving average slope with histogram

We can use this indicator to create many entry signals. But remember that Moving Average are a lagging indicator and is good only for trend confirmation.

moving average slope with signal

If you want download this indicator, choose your platform:


Using Moving Average Slope to filter the trend

We could use this indicator in many trading system strategies to filter the trend. A lot of traders use moving average to filter the trend. It’s important to understand there is no trend in the small period. If we need to filter the trend, we need to use at least at 40-period Moving Average.

This indicator is handy when you have many charts on your screen:


Learn how to code the Moving Average Slope Indicator

If you want to learn how to code the moving average slope indicator with TradeStation and MultiCharts using EasyLanguage and PowerLanguage, this is the code:

Moving Average Slope Indicator-Code1

Firstly, we set the color as a variable, and we initialize it with “white.”  After that, we have to calculate the inclination of our Moving Average Slope Indicator.

We compare the last 3 Moving Average price at Close. When the value is increasing, we have an uptrend and vice-versa. You could also use a 2-period Moving Average, but in this way, the color will change too frequently.

Let’s how to calculate the inclination of our Moving Average Slope Indicator with EasyLanguage and PowerLanguage for TradeStation and MultiCharts:

Moving Average Slope Indicator Code2

Relative Strenght Index (RSI) SLOPE INDICATOR

We can also modify an RSI indicator and change it in a Relative Strength Index Slope Indicator:

Moving Average Slope Indicator Code3

For the Relative Strenght Index (RSI), we used only two periods.

Rsi Slope TradeStation Multicharts


From INVESTOPEDIA: “Moving averages can help smooth out these erratic movements by removing day-to-day fluctuations and make trends easier to spot.”


Editors’ Recommendations: