I think it would be very easy for you to do please help me,
Thank you all for your hard work, Amibrocer code for ndx is different than the metatrader version,
what's the problem ?,
I guess the problem could tema in amibroker. please help me and , do fix it. Thank you
//metatrader code for ocean ndx
.
.
.
for(i = limit; i >= 0; i--)
{
double SumWght = 0, SumDnom = 0, DifAry, DnomAry, FracAry, TimeAry, WgtAry;
for(ii = 1; ii <= NDX_period; ii++)
{
DifAry = MathLog(Close[i+ii-1]) - MathLog(Close[i+ii]);
if(ii == 1) DnomAry = MathAbs(DifAry); else DnomAry += MathAbs(DifAry);
if(DnomAry == 0) FracAry = 0; else FracAry = (MathLog(Close) - MathLog(Close[i+ii])) / DnomAry;
TimeAry = 1 / MathPow(ii, 0.5);
WgtAry = FracAry * TimeAry;
SumWght += WgtAry;
SumDnom += TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;
}
double ExpSmooth = 2, XAvg1, XAvg2, XAvg3;
ExpSmooth = ExpSmooth / (SmLen + 1);
for(i = bars - NDX_period - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNDX - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNDX = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
if(i < bars - NDX_period - 1 - 3*SmLen)
{
if(maNDX > 90) NDX = MathRound(90 + (maNDX - 90) / 2);
else if(maNDX < -90) NDX = MathRound(-90 - (MathAbs(maNDX) - 90) / 2);
else NDX = MathRound(maNDX);
}
}
.
.
.
//amibrocer code for ocean ndx
NDX_period = Param("NDX Period",75,40,375);
NDX_SmLen = round(NDX_Period*20/40);
SumWght = 0;
SumDnom = 0;
for(i = 1; i < NDX_period+1; i++)
{
DifAry = ln(Ref(Close,-i+1)) - ln(Ref(Close,-i));
if(i == 1)
DnomAry = abs(DifAry);
else
DnomAry =DNomAry+ abs(DifAry);
FracAry =IIf(DNomAry==0, 0,(ln(Close) - ln(Ref(Close,-i))) / DnomAry);
TimeAry = 1 / (i^( 0.5));
WghtAry = FracAry * TimeAry;
SumWght =SumWght+ WghtAry;
SumDnom =SumDnom+ TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;
TemaNDX= TEMA(RawNDX,NDX_SmLen);
Plot(TemaNDX,"NDX",colorRed,styleLine);