Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Arnaud Legoux Moving Average for Amibroker (AFL)
ALMA (Arnaud Legoux Moving Average) is an Free Open Source Zero-phase Digital filter formula which has been created by Arnaud Legoux and Dimitrios Kouzis-Loukas. It uses a Gaussian distribution shifted with an offset so that it’s not evenly centered on the window but biased towards the more recent days.
The ALMA is a Moving Average which performs better than the HMA. ALMA is inspired by the Gaussian Filters and it attacks a fundamental assumption of the Moving Averages we described before.
Similar Indicators / Formulas
Indicator / Formula
function ALMA(priceField, windowSize, sigma, Offset) { m = floor(Offset * (windowSize - 1)); s = windowSize / sigma; w = 0; wSum = 0; for(i = 1; i < windowSize; i++) { w[i] = exp(-((i-m)*(i-m))/(s*s)); // 2 should be there? wSum += w[i]; } for(i = 1; i < windowSize; i++) { w[i] = w[i] / wSum; } outalma = Null; for(j = 0; j < BarCount; j++) { alSum = 0; if(j < windowSize) { outalma[j] = Null; } else { for(i = 1; i < windowSize; i++) { alSum += priceField[j - (windowSize - 1 - i)] * w[i]; } outalma[j] = alSum; } } return outalma; } p = ParamField("Price Field"); windowSize = Param("Window Size", 9, 5, 201, 2); sigma = Param("Sigma", 6, 1, 20); Offset = Param("Offset", 0.85, 0.05, 1.0, 0.05); Plot(ALMA(p, windowSize, sigma, Offset), "ALMA", ParamColor("Color", colorBlue), ParamStyle("Style"));
5 comments
Leave Comment
Please login here to leave a comment.
Back
vivekjain,
It says a lot about your ethics that you did not feel the need to acknowledge the original coder of this AFL. However, this particular implementation of ALMA in amibroker is not quite accurate. The correct accurate implementation of ALMA in conformance with Ninja Trader and Meta Trader releases by the original developers of ALMA i.e Arnaud & Legoux has been submitted by me so that amibroker users can also benefit.
just one word, this is fantastic
ALMA can be coded using the FIR function. By accident I bumped into this writing:
http://www.amibroker.com/guide/afl/fir.html
which does not seem to pop up when you look in the manual. FIR allows you to do a convolution of an input array with a some smaller function like a Gaussian window type function. resulting code:
in fact it can be programmed using:
give s error