PureBytes Links
Trading Reference Links
|
Dear Natasha,
It has been defintely a worthwhile time spent on it, now i need to chk
how better it works if we are able to forecast it. Below is the
formula, I welcome any improvements on it to further smoothen it out.
//
// This Routine requires the following things
//
// P0 = A price array or synthetic
//
// Goal = The goal value of the indicator
//
// Acc = An accuracy level for the calculations
//
// Set this to the order of magnitude
// that you want. For example if you want
// accuracy in calculated price to within
// 0.01 then set it 0.01. It can even
// be set to 0 which will force AB to
// calculate until it can't find any
// further improvements (Usually between
// 150-170 iterations) but this is semi
// useless as improvements relative to
// price granularity have long since
// been gone by.
//
// The lower you set it the longer it
// will take but it's pretty quick
// (Usually between 15-30 iterations)
// unless you set it at 0.
//
// ***********************************************
//
// Note: Some goals are virtually unattainable on
// the next bar, especially on the downside
// as they would require a negative price
// which is what this routine will show if
// that is what is required.
//
// ***********************************************
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 = TEMA(P1,12)-TEMA(P1,26);
Goal = LastValue(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(Ref(P1, -1) / Mult, "Todays Price", 1.2);
AddColumn(P1 / Mult, "Goal Price", 1.2);
AddColumn(P0-P1 , "Goal Price diff", 1.2);
AddColumn(Mult,"Multiplier", 1.0);
AddColumn(Calc[LVBI - 1] / Mult, "Curr Ind Val", 1.2);
AddColumn(Goal / Mult, "Goal Ind Val", 1.2);
AddColumn(Calc[LVBI] / Mult, "Calc Ind Val", 1.2);
AddColumn(j,"Iterations", 1.0);
AddColumn(Accuracy, "Accuray (%)", 1.2);
Fazal
--- In amibroker@xxxxxxxxxxxxxxx, Natasha !! <dynomitedoll_ddd@xxxx>
wrote:
> Hi,
> Since you have been working on it for sometime it must be quite
worthwhile.How about posting the finished end product here so everyone
may benifit .
>
> -- N !!
>
>
> fz_iqbal <stockslover@xxxx> wrote:
>
> HI,
>
> Missed the action and updates here due to holiday yesterday, it is
> wonderful to see the resolution of my problem, Thanks vichoo,fred
and
> Thomas for following it further and resolving it for me.
>
> It is an experience worth remembering as I have been behind cracking
> this for last few months.
>
> Thanks once again to vichoo,Fred and Thomas.
>
> Fazal
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxxx> wrote:
> >
> > Calc = TEMA(P1,12)-TEMA(P1,26);
> > Goal = LastValue(EMA(TEMA(P1,12)-TEMA(P1,26),9));
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Thomas Zmuck" <tzg@xxxx> wrote:
> > > Hi,
> > >
> > > i have posted the code yesterday. You get the close price if
both
> > values are
> > > exactly the same. This happens very rarely but below is the
code.
> > >
> > > Samevalue = TEMA(C,12)-TEMA(C,26)==EMA(TEMA(C,12)-TEMA(C,26),9);
> > >
> > > Filter = samevalue;
> > > AddColumn(C,"Close");
> > >
> > > Regards
> > >
> > > Thomas Zmuck
> > > www.tradingbasis.com
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: vichooo_1999 [mailto:vichooo_1999@x...]
> > > Sent: Sunday, March 27, 2005 11:33 AM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: TEMA - Kind Attn : Fred
> > >
> > >
> > >
> > >
> > > Hi Fred
> > >
> > > Thanks for your reply.
> > >
> > > The Goal is to find the price at which TEMA(c,12)-Tema(c,26) is
> > > equal to EMA((tema(c,12)-Tema(c,26)),9)
> > >
> > > Hope u can code it easily.
> > >
> > > Thanks once again
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxxx> wrote:
> > > >
> > > > Please provide both sides of the formula as follows ...
> > > >
> > > > Part 1 - What's the goal ?
> > > >
> > > > Part 2 - What do you want to reach the goal ? Price or
something
> > > > else ?
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "fz_iqbal" <stockslover@xxxx
>
> > > wrote:
> > > > >
> > > > > Dear Fred,
> > > > >
> > > > > Like Vichoo, I also tried my best with the code u gave, but
> > > Thanks
> > > > > Fred I am still unable to get the price at which TEMA MACD
> > > cross
> > > > over
> > > > > will take place.
> > > > >
> > > > > I would be highly grateful if you could kindly code the
above
> > as
> > > > this
> > > > > seems to be more complicated than what visualised earlier.
> > > > >
> > > > > Fazal
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "vichooo_1999"
> > > > <vichooo_1999@xxxx>
> > > > > wrote:
> > > > > >
> > > > > > 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);
> > >
> > >
> > >
> > >
> > >
> > >
> > > 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
>
>
>
>
>
> 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 SponsorADVERTISEMENT
>
>
> ---------------------------------
> 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 the Yahoo! Terms of
Service.
>
>
>
> Warm regards,
> Natasha !
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
------------------------ 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/
|