ALMA Smoothing of StochK - Needed

 

Can anybody make ALMA Smoothing of Stochastic K for MT4? Screen shot attached.

Here is the code in Amibroker AFL :

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 = exp(-((i-m)*(i-m))/(s*s));

wSum += w;

}

for(i = 1; i < windowSize; i++)

{

w = w / 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;

}

outalma[j] = alSum;

}

}

return outalma;

}

_SECTION_BEGIN("Stoch ALMA");

r = StochK( ); // Default is 14 Period

r1=ALMA(StochD( ), 7, 8, .85);

Plot( r, "StochK(14)", colorOrange,styleThick );

Plot(r1,"ALMA Smooth 7",colorWhite,styleThick);

_SECTION_END();

Files:
 
eda236:
Can anybody make ALMA Smoothing of Stochastic K for MT4? Screen shot attached.

Here is the code in Amibroker AFL :

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 = exp(-((i-m)*(i-m))/(s*s));

wSum += w;

}

for(i = 1; i < windowSize; i++)

{

w = w / 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;

}

outalma[j] = alSum;

}

}

return outalma;

}

_SECTION_BEGIN("Stoch ALMA");

r = StochK( ); // Default is 14 Period

r1=ALMA(StochD( ), 7, 8, .85);

Plot( r, "StochK(14)", colorOrange,styleThick );

Plot(r1,"ALMA Smooth 7",colorWhite,styleThick);

_SECTION_END();

eda236

You can use this one : stochastic__alma.mq4

__________________

Chose make stochastic with alma signal line in options, set the stochastic sllowing period to 1 and then you are going to get alma signal line of stochastic K. The rest is "extra"

Files:
 

PS: I would consider using sample value for alma set to less than that 0.85 (it is much faster with the usual 0.25 for sigma used and is not losing on smoothness)

 
mladen:
PS: I would consider using sample value for alma set to less than that 0.85 (it is much faster with the usual 0.25 for sigma used and is not losing on smoothness)

Excellent. Thank you. Will 0.65 be an optimal value for ALMA Sample and 9 for Stochastic Slowing Period?

 
eda236:
Excellent. Thank you. Will 0.65 be an optimal value for ALMA Sample and 9 for Stochastic Slowing Period?

It looks like a reasonable choice

 
mladen:
PS: I would consider using sample value for alma set to less than that 0.85 (it is much faster with the usual 0.25 for sigma used and is not losing on smoothness)

Dearest MLADEN

so it looks 3 in 1 stoch of ALMA,interesting.thanks.

regards