[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: TEMA - thanks Fred



PureBytes Links

Trading Reference Links


Hi Fred

I have been trying for last 30 mins or so I am unable to proceed 
further. Kindly review the code please:

P0 = C;
Acc = 0.0001;
LVBI = LastValue(BarIndex());
Mult = 1;
for (i = 0; i < 10; i++)
{
if (P0[LVBI] >= 1)
i = 99;
else
Mult = Mult * 10;
}
// ***********************************************

P1 = Ref(P0, 1) * Mult;
UpDn = 100 * P1[LVBI];

for (i = 0; i < 200; i++)
{

Calc = P1;
Calc = TEMA(P1,12);
Calc = TEMA(P1,26);
Calc=TEMA(P1,12)-TEMA(P1,26);
Calc=EMA((TEMA(P1,12)-TEMA(P1,26)),9);
Goal = TEMA(P1,12)-TEMA(P1,26)==EMA((TEMA(P1,12)-TEMA(P1,26)),9);

if (Calc[LVBI] < Goal)
P1[LVBI] = P1[LVBI] + UpDn;
else
P1[LVBI] = P1[LVBI] - UpDn;
UpDn = UpDn / 2;
if (UpDn <= Acc)
{
j = i;
i = 99999;
}
}

Accuracy = 100 * (abs(Goal - Calc) / Goal);

Filter = BarIndex() == LVBI;

AddColumn(Mult,"Multiplier", 1.0);
AddColumn(Calc[LVBI - 1] / Mult, "Curr Ind Val", 1.9);
AddColumn(Goal / Mult, "Goal Ind Val", 1.9);
AddColumn(Calc[LVBI] / Mult, "Calc Ind Val", 1.9);
AddColumn(j,"Iterations", 1.0);
AddColumn(Accuracy, "Accuray (%)", 1.9);
AddColumn(Ref(P1, -1) / Mult, "Todays Price", 1.9);
AddColumn(P1 / Mult, "Goal Price", 1.9);





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/