ALMA (Arnaud Legoux MA) Indicator for ThinkorSwim

M

Miket

Member
Hello All, here is my contribution to the blog as I don't believe in taking without giving back. I hope someone can find as useful as I have.

The goal of the Arnaud Legoux Average is to decrease the noise and generate a more reliable signal than the conventional moving averages.

It does this by applying the average from left to right (the usual way), and then it applies the reverse and makes a combo line. This combo signal is then adjusted by applying a Gaussian Offset that can adjust the combo line to the current price and a sigma (standard deviation).

thinkScript Code

Rich (BB code):
script ALMA {
input Data = close;
input Window = 9;
input Sigma = 6;
input Offset = 0.85;

def m = (Offset * (Window - 1));
def s = Window/Sigma;

def SumVectorData = fold y = 0 to Window with WS do WS + Exp(-(sqr(y-m))/(2*sqr(s))) * getvalue(Data, (Window-1)-y);
def SumVector = fold z = 0 to Window with CW do CW + Exp(-(sqr(z-m))/(2*sqr(s)));

plot ALMA = SumVectorData / SumVector;
}

input Window = 9;
input Sigma = 6;
input Offset = 0.85;

plot ALMA = ALMA (close, Window, Sigma, Offset);
ALMA.setPaintingStrategy(PaintingStrategy.LINE);
ALMA.SetDefaultColor(Color.CYAN);
ALMA.HideTitle();
ALMA.HideBubble();

Shareable Link

http://tos.mx/9mznij
 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@Miket Thanks for sharing. I renamed the title of the post and also included the source code just in case anyone want to take a sneak peak at it before adding.

 
Last edited:
S

San

Member
VIP
@Miket, Thanks for sharing this indicator and this is something different than EMA. Do you suggest any other indicator which we can combine with this.

 
Last edited:
M

Miket

Member
Any other indicator that would help confirm trend would be beneficial. I like it because its doesnt have overshoot one way or the other. It's tight.

 
Last edited:
L

Lambert58

New member
Warehouse
I get a lot of value using the ALMA, however I can not locate any scans which would employ 2 ALMA windows (look-back) values which could be adjusted by the user. I did not see the ALMA as a choice in the StockHacker scan menu. Does anyone know where I may find these scans?
 
H

horserider

Well-known member
VIP
Warehouse
@Miket @Lambert58 I suggest trying MAMA or EHMA.
 
markos

markos

Well-known member
VIP
Warehouse
@Lambert58 Put this on your chart or scan twice and adjust the input length. I hope this helps. :)
You'll have to consult the manual or another code to get numbers in your scan.

Code:
# ArnaudLegouxMA_Mobius
##with color change  below##
# ALMA (Arnaud Legoux Moving Average)
# ALMA is based on a shifted Gaussian distribution
# Mobius
# Chat Room Request No Date (2017 - 2019)
## ALMA color change added by ZupDog

input offset = 2;
input sigma = .5;
input length = 8;
plot alma_ = (fold n = 0 to length
              with s
              do s + getValue(Exp(-Power(n - Floor(offset * length), 2)/
                             (2 * Power((length + 1) / sigma, 2)))*
                     getValue(close, n), n, length)) /
              fold nn = 0 to length
              with ss
              do ss + getValue(Exp(-Power(nn - Floor(offset * length), 2)/
                              (2 * Power((length + 1) / sigma, 2))), nn);
alma_.DefineColor("Up", GetColor(1));
alma_.DefineColor("Down", GetColor(0));
alma_.AssignValueColor(if alma_ > alma_[1] then alma_.color("Up") else alma_.color("Down"));
# End Code ALMA
 
markos

markos

Well-known member
VIP
Warehouse
@Miket, Thanks for sharing this indicator and this is something different than EMA. Do you suggest any other indicator which we can combine with this.
@San This suggestion may help: Take a blank chart and put each type of MA in an upper, set them all to the same length, and see how they react on different time frames. It's a fun learning exercise.
 
S

San

Member
VIP
@San This suggestion may help: Take a blank chart and put each type of MA in an upper, set them all to the same length, and see how they react on different time frames. It's a fun learning exercise.
@markos, Hey thanks for your suggestion.... I will start practicing... I am slowly getting it... I really appreciate you and forum for quick response. :)
 
H

HighBredCloud

Active member
I've tested this ALMA against the Ehlers Super Smoother Filter that is found in TOS...and the Ehlers works better primarily because you can use the variations of Ehlers in other Moving average forms like the 20 50 100 200 etc...You just need to multiply the regular known MA by .58 to get the Ehlers equivalent...For example such as 20 MA x .58 = 11.6 Then add 20 + 11.6 and you'll get the equivalent to I believe weighted MA but with super smooth curves...hope this helps
 
L

Lambert58

New member
Warehouse
Thanks for everyone's input and offering their experience. The real diamond is when I tracked down a tiny thread which led me to find all of you at this community.
 
H

horserider

Well-known member
VIP
Warehouse
@Lambert58 Welcome. There are many Moving average variations. Most times by changing inputs you can get them to match each other. Just pick one you like and go with it.
 
A

ajsimon_us

New member
VIP
Warehouse
Marketplace
Thanks for sharing. can you help to understand on how to use this please?
 
L

Lambert58

New member
Warehouse
My interpretation is to use which ever MovAvg you choose, in the example above it was 20 MA X.58 = 11.6. Add(11.6) to 20 = 31.6 or 32. This would be the value for the Ehlers equivalent. The smoothing of the MA curve helps to avoid whipsaws. I am learning, so in the event my interpretation is not correct, standby, someone will more experience will usually clarify.
 
H

HighBredCloud

Active member
My interpretation is to use which ever MovAvg you choose, in the example above it was 20 MA X.58 = 11.6. Add(11.6) to 20 = 31.6 or 32. This would be the value for the Ehlers equivalent. The smoothing of the MA curve helps to avoid whipsaws. I am learning, so in the event my interpretation is not correct, standby, someone will more experience will usually clarify.
@Lambert58 The example I referenced above was for Ehlers Super Smoother Filter that is found in TOS. If you compare both ALMA and the default setting of SuperSmootherFilter that is set to 10 you will see that they are practically identical. The reason why I like Ehlers better is that you can get other averages like the 20 50 etc...all you have to do is X .58 and add on to the original moving average as you stated above...

By doing such a conversion I believe that the Ehlers Super Smoother Filter will reflect the same as a standard WMA of 20 50 etc...but with much smoother lines and curves.
 
Thread starter Similar threads Forum Replies Date
ebtrader Questions 3

Top