kurtsmock

ALMA Function [FN] - Arnaud Legoux Moving Average

This hasn't been done before. People know the ALMA moving average, TradingView, of course, has a built-in function for the ALMA = alma (). But, when you use built-in functions, you can't have a series as a length. Pinecoders put out a bunch of functions for various routines wherein the built-in doesn't allow for a series as a length. I got some help from @everget (awesome dude) to do the dev() function as well... can't find the ALMA anywhere. So, here it is. It seems to match the built-in indicator. To double-check me, just put the ALMA built-in over this and they should match. Let me know if you find an issue.
That's it. ALMA is cool. I'm going to use it as the average for the CCI . Good day.
เอกสารเผยแพร่: Just gussied up the code. I made it more copy/paste-able. Works good
เอกสารเผยแพร่: ♫ Had a little help from my friends ♫
Midtownsk8terguy reached out and facilitated the improvement of the code design. They were good edits. We're stronger together =) Thanks man.
See notes in the code.
สคริปต์โอเพนซอร์ซ

จากใจ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ยินดีด้วย! คุณสามารถใช้มันได้ฟรี แต่การใช้โค๊ดนี้ซ้ำเพื่อการเผยเเพร่ อยู่ภายใต้ กฎของเรา คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้กับชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

ความคิดเห็น

Thanks for your lovely contribution to the library and Pine itself. Your improved alma version is now provided as default to all members. ♥
100 เหรียญ
ตอบกลับ
This publication will be featured in our "Best Scripts of The Month" selection. Thank you for your valuable contribution to the TradingView community, and congrats!
+3 ตอบกลับ
kurtsmock PineCoders
@PineCoders, Thanks! You guys are awesome.
+2 ตอบกลับ
Nice work, thank you for sharing!
+2 ตอบกลับ
kurtsmock allanster
@allanster, I never said thank you. I appreciate you @allanster You're the best
ตอบกลับ
thanks buddy! good one! <3
+2 ตอบกลับ
great work
+1 ตอบกลับ
Rookie / n00b questions here.

I love the ALMA, and use it a lot on other platforms. I'm using tradingview more these days, and learning pinescript.

What does it mean to use "a series as a length"?

You also mention running the ALMA over CCI. How would you do that?
ตอบกลับ
kurtsmock kasinath
@kasinath, Good questions.
A series, among other things, is a dynamic output of the calculation of a function, most often a built-in function.
for example if you wanted to do something like alma() , but on each candle, you recalculate the length, that won't work on TV. You need an integer for the length to use the built-in function.
Say you want the length of the function alma() to be: barssince(pivothigh(10)). That is a series; a dynamic output of a function. Every new bar the length goes up by one as time/candles move away from the pivot, then goes to zero when the new pivot is set.
If you are using static lookback lengths, then using the built-in alma() function will work fine. But if the length changes as the chart runs, You need a custom function like the above to make it work.

CCI is an indicator based on mean deviation. So, over +100/-100 is above/below the 1.25 standard deviation of the MEAN or average. So 'length' as a part of the CCI calculation includes a sma() function to establish the mean. Otherwise stated the standard CCI is the mean deviation from the SMA20.
Essentially instead of using an SMA to determine the average of the CCI, you use an ALMA average instead.
This requires a user-defined function to work. Can't do it with the built-in CCI function.

Please let me know if that made sense and answered your question. :)
+1 ตอบกลับ
kasinath kurtsmock
@kurtsmock,
Brilliant! Makes total sense. Thanks for this clear and thoughtful answer.

I will play around with this, and look more into using the ALMA with other indicators. I run SMA on OBV (in metatrader), but i think i will try ALMA instead here on TV (fixed length should be fine).

I've never done this in TV (applying an MA to an indi series) please let me know if there are any gotchas i should look out for.

Thanks again!
ตอบกลับ