Dear All,
I frequently use ALMA-indicator for signals; It is very relyable for me. BUT, I would like to “improve” by adding 3x lines (bands) to the original ALMA-indicator (see photos attached).
MY idea:LONG
– when [close] cross over ALMA –> open 1x position (+1)
– when [close] cross over “middle” band –> add 1x position (+2)
– if [close] cross over “highest” band –> close 1x position (+1)
– when [close] cross under ALMA –> close all positions (+/- 0)
Please, who could help my coding these bands? I attached the code from MT5; hopefully it will be helpful!
Thank you very much in advance.
Micha
That’s an ALMA average with floating levels made of last X periods Highs/Lows of the ALMA. Let me look at this..
Here we go:
Window = 14
Sigma = 6
Offset = 0.25
flPeriod = 25 // Floating levels look back period
flLevelUp = 90 // Floating levels up level %
flLevelDown = 10 // Floating levels down level %
Price = customclose
m = (Offset * (Window - 1))
s = Window/Sigma
WtdSum = 0
CumWt = 0
for k = 0 to Window - 1 do
Wtd = Exp(-((k-m)*(k-m))/(2*s*s))
WtdSum = WtdSum + Wtd * Price[Window - 1 - k]
CumWt = CumWt + Wtd
next
val = WtdSum / CumWt
imin = lowest[FlPeriod](val)
imax = highest[FlPeriod](val)
rrange = imax-imin
flup = imin+FlLevelUp *rrange/100.0
fldn = imin+FlLevelDown*rrange/100.0
flmi = imin+50 *rrange/100.0
return val as "ALMA average", flup coloured(34,139,34) style(dottedline), fldn coloured(220,20,60) style(dottedline), flmi coloured(169,169,169) style(dottedline)
There are different ways to color the ALMA (that I did not code), depending of its position compared to the bands or by its own slope, do you use one of them?
Dear Nicolas,
thank you very much for your support. Please find below my ALMA-indicator..
The change of the ALMA-colour is very important; could you please code with the original colour change?
Merci beaucoup.
Micha
// parameters
DEFPARAM CalculateOnLastBars = 1000
Window = 10
Sigma = 6
Offset = 0.55
Price = Close
m = (Offset * (Window - 1))
s = Window/Sigma
WtdSum = 0
CumWt = 0
for k = 0 to Window - 1 do
Wtd = Exp(-((k-m)*(k-m))/(2*s*s))
WtdSum = WtdSum + Wtd * Price[Window - 1 - k]
CumWt = CumWt + Wtd
next
ALAverage = WtdSum / CumWt
RETURN ALAverage
Hello Nicolas,
I was able to add ALMA-colour myself:
Window = 10
Sigma = 6
Offset = 0.55
flPeriod = 25 // Floating levels look back period
flLevelUp = 90 // Floating levels up level %
flLevelDown = 10 // Floating levels down level %
Price = customclose
m = (Offset * (Window - 1))
s = Window/Sigma
WtdSum = 0
CumWt = 0
for k = 0 to Window - 1 do
Wtd = Exp(-((k-m)*(k-m))/(2*s*s))
WtdSum = WtdSum + Wtd * Price[Window - 1 - k]
CumWt = CumWt + Wtd
next
ALAverage = WtdSum / CumWt
imin = lowest[FlPeriod](ALAverage)
imax = highest[FlPeriod](ALAverage)
rrange = imax-imin
flup = imin+FlLevelUp *rrange/100.0
fldn = imin+FlLevelDown*rrange/100.0
flmi = imin+50 *rrange/100.0
return ALAverage as "ALMA average", flup coloured(34,139,34) style(dottedline), fldn coloured(220,20,60) style(dottedline), flmi coloured(169,169,169) style(dottedline)
Thank you very much.
All the best,
Micha