Moving Average Slope

Moving Average Slope

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
Volatility
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.

Advantages

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.

Interpretation:
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.

Variables
– maPeriod :: the moving average period. This is normally set at 200 by defailt
– maType :: the moving average method. Expotential average is the default

Please reach out if there are any questions.

Share this

Risk disclosure:

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 : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 05/25/2017 #

    Hi Maz, it’s always a pleasure to review your post, they are always perfectly well formatted with all the required files 🙂 Perfect for a sunny holiday day like today! 😉

  2. Robert • 05/25/2017 #

    Great work! Could be useful 🙂

  3. Tedvin • 05/25/2017 #

    Nice one, thanks a lot Maz 🙂

  4. victormork • 05/25/2017 #

    Thanks Man!!

  5. MtraderWD40 • 05/25/2017 #

    Many thanks for sharing this, simple but a great indicator. Used it successfully for visual scanning of potential breakout and scalping.  i use it with maPeriod = 50

  6. juanj • 05/25/2017 #

    Having a moving average bar running above 0 for the green bars and below 0 for the red bars would be a nice addition.

  7. juanj • 05/25/2017 #

    I mean a moving average line

  8. juanj • 05/25/2017 #

    I coded the above indicator into a strategy, seems to be profitable on the EURUSD 1Hr

  9. Leo • 05/25/2017 #

    I just have a question about trading.
    What is better for use as a filter in trading (long): long term moving average slope upwards or price above it or both?
    Thanks in advance

  10. Marcot18 • 05/25/2017 #

    Buongiorno, è possibile codificare lo stesso codice per regressione lineare? grazie in anticipo

    • Nicolas • 05/25/2017 #

      Just change the indicator at line 9 with a linearregression instead of average

  11. Marcot18 • 05/25/2017 #

    Save Nicolas, non ci riesco puoi postarmelo grazie.

  12. Sumihiko Tachibana • 05/25/2017 #

    I need help to write this script on TD Ameritrade thinkorswim (TOS). How to make it work on TOS? Thanks…

    • Nicolas • 05/25/2017 #

      We do not offer free assistance for TOS. However, you can send demand for private paid coding at: https://www.prorealcode.com/trading-programming-services/

  13. phanz • 05/25/2017 #

    Hi community. May I know how you use this indicator please? Is it on the zero cross over? or the histogram above or below a certain level? My understanding is zero cross over points to the direction, where as histogram above certain level points to the strength of the strength? So for a buy signal, look for a zero cross over, positive histogram above a certain number? What number on the y-axis will point to a healthy trend?

  14. sydney43025 • 05/25/2017 #

    Hello, I’m digging up this topic because I uploaded the code on a PRT v11.1 but the indicator loads on the price chart without displaying any histogram. I can’t get it under the price chart. Something happens when I drag the indicator to the RSI panel for example but there is obviously a problem with scaling. Do we need to amend the code for the last PRT versions ? Thanks.

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+5 more likes

Related users ' posts
capgros Bonjour @Nicolas, Thanks a lot for this tool, it is very useful for me. I would like to s...
Hans63 Would you add the possibility to color also the Heikin Ashi and bar chart?
Nicolas That's possible, please open a new topic in the indicator forum explaining what you need exa...
DimKar Dear sir , thank you very much for sharing !!!! it is awesome ...!!! Please can you tell me...
Nicolas Change line 62 with: drawcandle(flup,fldn,flup,fldn) coloured(169,169,169,80) bordercolor(16...
DimKar Thank you very much from Greece sir , have a nice day ....!!!! Really i do not have words...
ottimo Thank you Nicolas, great indicator, N. 1
tikigai Merci Nicolas! First Happy new Year 2020. Very good indicator BUT (yes the french "oui, m...
Nicolas Whats prorealtime version? Did you try in version prior to v11? indicator's call and loop ca...
Nicolas Yes, that's how it goes when using loops..
JosephFelix Hi, Could I please have help with adding these indicators 'on price'? Every indicator that I...
Nicolas Just add it on price by clicking the wrench on the left upper side of the price chart.
Nicolas Thanks for the update David!
sublime06 quelle parametre utilisé vous pour obtenir ces resultat ? merci
ullle73 you still use tihs one David?
fisiotrancos Hola, seria posible añadir una línea horizontal en el nivel 0? Me gustaría hacer un screener...
Nicolas cambiar la última línea por ésta: return val coloured(r,g,b) style(line,2), levelu style(do...
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
juanj Something appears to be wrong with this formula as graphing t shows t to almost never be wit...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
jamesoc Hi Nicolas, do you happen to know if there is an indicator that can be applied to charts, to...
gustavobp Buenos dias Nicolas, al agregar tu indicador no me reconoce la variable Price ni en la linea...
tradingpro salve io faccio spread trading e volevo sapere come impostare un profitto da chiudere in a...
Nicolas Per favore non fare domande generali, non correlate al post. Usa invece il forum.
Bard Incredible, that is the clearest depiction of the trend I've ever seen Nicolas. (I just chan...
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
rama I want to use this indicator in trading system, it says zig zag is obsolete and not supported
Nicolas Right, due to its repainting behavior, the zigzag is not allowed in automated trading with r...
rama I noticed it changes as time progress, I am 7 as the average, how many period it wont chang...
Gordon101 Hi when I added your Guppy indicator to my chart it went below the chart beside the oscilla...
Nicolas Add it on the price by using the wrench located on the left upper side of your price chart.
Gordon101 Thanks Nicolas, worked a treat.
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
ak5hay2 Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
richyowen Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on an...
lisamitch50 Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tel...
MaoRai54 Hi, first of all Happy New Year. Well, I've inserted your indicator in DAX 1h but I cann...
Vinks_o_7 Hi Mao Happy New Year ! This is just an improved RSI where you plot a standard price momen...
Nicolas Formule de l'indicateur Momentum: Le Momentum se calcule avec une simple soustraction pour ...
Roberto1 Hi, can this code be converted for the Nanotrader Platform or for the MT4 Platform?
Nicolas This website is dedicated for PRT programming, but you can still ask for private coding with...
swapping merci gabri, on va le mettre à l'essai ;)

Top