TradingView
ZenAndTheArtOfTrading
15 Jan 2021 pukul 09.09

Multiple Moving Averages 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Huraian

This script adds up to 5 moving averages to your chart - and you can select which moving average type (and timeframe) you want to use for each.

The possible MA type options are:

  • EMA
  • SMA
  • HMA
  • WMA
  • DEMA
  • VWMA
  • VWAP


You can specify the length of each moving average, and you can override the type of all moving averages with the setting "ALL MA TYPE".

There is also higher-timeframe functionality, so you can select the timeframe for each moving average.

If the "Smooth HTF MA" setting is turned on then the script will fill any gaps in intraday price data by averaging the difference (giving it a regular smooth look), and if it's turned off then the HTF MAs will have a "stepped" look to them. Technically speaking, the non-smoothed setting is more accurate and so it's turned off by default.

And finally, the first option "Color MA 1" will change your first MA's color based on whether price action is above that MA's price or below it. If it's above it then the color turns green, if it's below it then it turns red.

If you set an MA's length to zero it will disable that MA.

The source code is protected but available on my website (link in my profile).

Enjoy! Good luck with your trading :) 😎

Nota Keluaran

Added alert functionality:
- MMA Alert = Price touched one of the moving averages
- MA1 Alert = Price touched first MA
- MA2 Alert = Price touched second MA
- MA3 Alert = Price touched third MA
- MA4 Alert = Price touched fourth MA
- MA5 Alert = Price touched fifth MA

Nota Keluaran

Fixed pesky typo

Nota Keluaran

Fixed incorrect input titles

Nota Keluaran

-
- Fixed alerts not working

Nota Keluaran

Updated to Pine Script v5
Komen
shibhuk
can we set alerts only when the candle "open & close" or "close" above or below the MA?
daee
thanks first of all. This seems to have some issues while using HMA?

"Study Error
Invalid value of the 'length' argument (0.0) in the 'wma' function. It must be > 0"

I haven't really changed any values besides switching the "All MA type" to HMA.
ZenAndTheArtOfTrading
@daee, Hmm that's a strange one, thanks for letting me know. Not sure why it only does that when selecting HMA for All as the other types all work fine and the code is the same for them all. Until I can figure out how to fix it, you'll need to set all of the MA lengths to something other than zero (so if you're using the default values, put any number higher than 0 into MA Length 4 & MA Length 5 and then in the Style menu you can turn those last 2 moving averages off so they don't draw if you don't want to use them). Sorry for the inconvenience!
MrVolcano
Good man. Thanks!
manmohan200980
Please add pivot point standard
jeevansrpm
Thanks much.. It would be nice if I can skip seeing MA labels on screen. Just need values next to Indicator
dukesaeed
One of the best around, very underrated
Lebih