OPEN-SOURCE SCRIPT

+ Ultimate MA

Actualizado
What is the "Ultimate MA" exactly, you ask? Simple. It actually takes as its influence the Rex Dog Moving Average (which I have included as an MA in some of my other indicators), an invention by xkavalis that is simply an average of different length moving averages.
It's available for free on his account, so take a look at it.
I've recently become drawn to using fibonacci sequence numbers as lookbacks for moving averages, and they work really well (I'm honestly beginning to think the number doesn't matter).

You can see where this is going. The Ultimate MA is an average of several (eight) moving averages of varying lengths (5 - 144) all of fibonacci numbers. Sounds pretty basic, right? That's not actually the case, however.
If you were to take all these numbers, add them up, then average them by eight you'd get ~46. Now, stick a 46 period moving average on the chart and compare it to this one and see what you get. They track price very differently. Still, this all sort of sounds like I'm copying the RDMA, which isn't a sin in itself but is hardly grounds for releasing a new MA into the wild.

The actual initial problem I wanted to tackle was how to take in to account for the entire range of price action in a candle in a moving average. ohlc4 sort of does this, but it's still just one line that is an average of all these prices, and I thought there might be a better way not claiming that what I came upon is, but I like it).
My solution was to plot two moving averages: one an average of price highs, and the other an average of lows, thus creating a high/low price channel. Perhaps this is not a new thing at all. I don't know. This is just an idea I had that I figured I could implement easily enough.
Originally I had just applied this to a 21 period EMA, but then the idea sort of expanded into what you see here. I kept thinking "is 21 the best?" What about faster or slower? Then I thought about the RDMA and decided on this implimentation.

Further, I take the high and low moving averages and divide them by two in order to get a basis. You can turn all this stuff on or off, though I do like the default settings.
After that I wanted to add bands to it to measure volatility. There is an RDMA version that utilizes ATR bands, but I could never find myself happy with these.
I just wanted something... else. I also, actually made my own version of xkavalis' RDMA bands with some of the extra stuff I included here, but obviously didn't feel comfortable releasing it as an indicator as I hadn't changed it enough significantly in my mind to fairly do so. I eventually settled on Bollinger Bands as an appropriate solution to apply to the situation. I really like them. It took some fiddling because I had to create a standard deviation for both the high and low MAs instead of just one, and then figure out the best combination of moving averages and standard deviations to add and subtract to get the bands right.

Then I decided I wanted to add a few different moving averages to choose from instead of just an EMA even though I think it's the "best." I didn't want to make things too complicated, so I just went with the standards--EMA, SMA, WMA, HMA-- + 1, the ALMA (which gives some adjustability with its offset and sigma).
Also, you can run more than one moving average at a time (try running an HMA with a slower one).

Oh yeah, the bands? You can set them, in a dropdown box, to be based on which ever moving average you want.

Furthermore, this is a multi-timeframe indicator, so if you want to run it on a higher time frame than the one you are trading on, it's great for that.

ALSO, I actually have the basis color setup as multi-timeframe. What this means is that if you are looking at an hourly chart, you can set the color to a 4h (or higher) chart if you want, and if the current candle is above or below the previous close of the basis on that higher timeframe you will know simply by looking at the color of it ((while still being on the hourly chart). It's just a different way of utilizing higher timeframe information, but without the indicator itself plotted as higher timeframe.

I'm nearly finished. Almost last thing is a 233 period moving average. It's plotted as an average of the SMA, EMA, and Kijun-sen.

Lastly, there are alerts for price crossing the inner border of the bands, or the 233 MA.

Below is a zoomed in look at a chart.
imagen

Much credit and gratitude to xkavalis for coming up with the idea of an average of moving averages.
Notas de prensa
Added alerts for price closing over any of the moving averages. Can't believe I didn't ship it with those, but it's fixed now.l
Notas de prensa
update to pinescript version5
Notas de prensa
-made SMA the default moving average
-added RMA (Wilder's moving average) as an option
-added a trailing Simple UMA as an option

imagen
In the image above there is an UMA-SMA, a UMA-RMA, and a trailing UMA on the RMA. The trailer is obviously the slowest one in yellow, the RMA is in pink, and the SMA is in blue-green.
Notas de prensa
- added multi-timeframe labels for 1h, 4h, D, 3D, and W
- now you can have an idea where higher/lower timeframe support/resistance might be if you're trading timeframes below or above
- wanted to add more timeframes but I'm almost over the limit on security calls
- if you want lower timeframes added to this, or timeframes in between, all you have to do is copy the indicator then go to the lines for "label.set_xy" and change the timeframes under "request.security". Furthermore, if you only use one of the MAs, just copy out that section into a new indicator. It's easy.

imagen
Notas de prensa
- made some changes to the description, cleaned up some code, and updated wording in the 'style' tab and in a few other cases--very minor stuff
- major stuff is changing the lookback periods used in the HMA--they now start at 8 and end at 233, instead of starting at 5 and ending at 144. It's still a very responsive moving average, but holds trend better than the fast version while still getting you into them in a timely manner.

Below is a snapshot of the updated HMA
s3.tradingview.com/snapshots/o/o7GrHMTB.png
Notas de prensa
imagen
Adaptive Moving Average (AMA)Candlestick analysisHMAMoving AveragesOscillatorssmavolatilitybands

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?


También en:

Exención de responsabilidad