PureBytes Links
Trading Reference Links
|
Ian:
>Er, I got lost three posts back, guys... (:-)
Damn, and one of those was my nice little description of double
exponential averages too. It might be an easier way to approximate
what you want to do. That, or JMA if you have it.
>Anyone have some code to play with that might plot the central 'trend
>line'...?
I think you're nitpicking decimal places here. Something fitted
over 250 bars isn't going to require precision to the nearest penny.
Invent an approximation for yourself; who knows, it might work even
better than that polynomial thing.
The polynomial code for EL probably exists somewhere; it's a
matter of finding the coefficients a,b,c, etc of a polynomial
a + b*x + c*x^2 + d*x^3... using a generalized linear least-squares
fit. The code is straightforward but not trivial; see for example
http://lib-www.lanl.gov/numerical/index.html and pick your
programming language, then see chapter 15.4.
Personally, I would not want to use a polynomial to fit market
data unless I knew for certain there is a cycle that can be backed
out (like with seasonal commodities). There's also the problem of
figuring out how high an order (maximum exponent) the polynomial
must have. The higher the order, the better the "fit" but you also
get more wiggles. The author of that web site you referenced seems
to have determined in advance how many waves a market must have in a
year, and determined the polynomial order accordingly.
--
,|___ Alex Matulich -- alex@xxxxxxxxxxxxxx
// +__> Director of Research and Development
// \
// __) Unicorn Research Corporation -- http://unicorn.us.com
|