Don't mean to pile on Khamsina along with Brian
- but if I read between the lines of the EasyLanguage it looks
like
Someone's doing a least squares fit of the
data over <len> bars..and if that's what the code is doing then it's
probably a linear regression line
fitted to the data.
There are functions in AFL that will do this
without having to loop through the arrays while you accumulate the sum of the
squares, Sumsqr.
They are linregr
linregslope linregintercept
If I'm correct about my guess of a linear
regression, then Dimitris Tsokakis posted several indicators on this
forum that would do just that, fit a linear regression to your
data
and project a line out to the hard right
edge.
Best regards
JOE
----- Original Message -----
Sent: Monday, June 13, 2005 7:07 PM
Subject: Re: [amibroker] An indicator
tricky to code !!! (for AFL gurus)
Khamsina,
I'm going to pick on you, but this is so common
in most programming forums that I feel I need to finally say
something:
It's time-consuming to convert an algorithm
when someone uses variable names like Y, SumSqr, Scale, etc. I don't
feel like helping if every line I'm thinking "what is he trying to
do!!??"
If you would like to get an answer more quickly
(or at all!) please
1) describe what this thing is supposed to do,
then
2) use variable names that clearly identify
themselves, like CurrDayMaxPrice, TimeScale, BarCounter, etc.
If you don't know anything about how this works
or what it does, then no one else will bother to figure it out either.
If on the other hand you give a description in clear language, then name your
variables clearly (and maybe, heaven forbid, include comments in your code!)
then I'm sure someone will jump to help you out.
Thanks. Just had to get that off my
chest.
Brian
----- Original Message -----
Sent: Monday, June 13, 2005 3:54
PM
Subject: [amibroker] An indicator
tricky to code !!! (for AFL gurus)
Hi,
I have been sweating on this indicator for
3 days (below, it's written in EasyLanguage) and I just can't translate
it into AFL :-( . Unfortunately, it far more difficult for me (loop,
array).
Many thanks in advance for your valuable
help, Regards,
Khamsina
Inputs: Len(Numeric); Vars:
Mean(0), j(0), k(1.253314), SumSqr(0), Scale(0), MaxY(0), MinY(0),
Rng(0); Arrays: X[100](0), Y[100](0);
Mean = Average((h+c+l)/3,
Len); SumSqr = 0; for j = 0 to Len - 1 begin X[j] = C[j] -
Mean; SumSqr = SumSqr + X[j] * X[j]; end; Scale =
SquareRoot(SumSqr / Len); Y[0] = X[0]; MaxY = X[0]; MinY =
X[0]; for j = 1 to Len - 1 begin Y[j] = Y[j - 1] +
X[j]; if Y[j] > MaxY then MaxY = Y[j]; if Y[j] <
MinY then MinY = Y[j]; end; Rng = MaxY - MinY; Estmtr = Log(Rng/(k
* Scale)) / Log(Len);
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo!
Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com
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
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
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
|