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

[amibroker] Re: Polynomial Trendlines



PureBytes Links

Trading Reference Links

Pretty much ? ... Probably ... The difference is that FFT's have poor 
resolution once the cycle length get's anywhere near the length of 
the data being analysed ... Due to the liklihood that cycles change 
length, amplitude and/or phase over time, adding more data to find 
longer cycle lengths typically has the effect of viewing an average 
rather than something close to current reality.

For example an FFT examing data of 1000 bars i.e. ~4 years of EOD 
bars will see accurately cycle lengths of roughly 500, 333, 250, 200, 
166, 143, 125, 111, 100, 90, 83 etc. bars with no real resolution in 
between.  When cycle lengths occur between these fairly spread apart 
points they will show up as adjacent bars in the histogram, both with 
some amount of amplitude depending on what the real wave length is.  
I don't know how or if the real wave length, amplitude and phase can 
some how be determined or calculated from the information gathered by 
an FFT or not ...

MEM & Trig Fits don't suffer from this as they have good resolution 
of cycle lengths over the entire data sample and possibly of cycle 
lengths even beyond the length of the data.

--- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxx> wrote:
>
> Fred,
> I had a look at Hurst's book - Appendix 6. The Grigonometric 
Function that
> he is proposing, when reduced to its canonical form, is pretty much 
a
> fourier series, isnt it? Rather than using Guassian Elimination - 
Least
> Square Curve Fitting, Wouldn't be more direct to obtain amps, phase 
angles
> and frequenies of the harmonics through FFT, and inverse transform 
to
> recreate the trigonometric series? might have filter out some of 
the extreme
> frequencies to get a nice curve. the order of the series can be 
determined
> by minimising the square of the prediction error like that of 
Warren in his
> MEM article.
> Cheers
> Paul.
>  
> 
>   _____  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On Behalf
> Of Fred
> Sent: Saturday, 7 October 2006 12:48 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Polynomial Trendlines
> 
> 
> 
> TJ,
> 
> I have long since had FFT capability in AFL as the algorithms are 
> very straight forward and relatively simple to do in AFL. However 
> FFT's typically require LOTS of data relative to the cycle lengths 
> one is attempting to identify and do not provide particularly good 
> resolution at the lower frequencies. From this perspective tools 
> like MESA ( The algortihm, NOT the black box product ) provide much 
> greater resolution with much less data.
> 
> However, neither of these approaches is what I'm after at this 
> juncture ... What I'm after is the ability to do trigonometric 
curve 
> fitting in a similar way to what the PolyFit AFL I posted performs 
> linear curve fitting i.e. via the solution of simultaneous 
> equations. This involves some rather sophisticated ( at least from 
> my perspective ) math which can be found for example in Appendix 6 
> of J.M. Hurst's book. Since the discussion there is only about 3 
> pages I'd be happy to post it or email it to anyone who has an 
> interest and is so inclined if they'd like to read it and comment 
on 
> how to implement it.
> 
> Fred
> 
> PS ... Some final thoughts about FFT's and their implementation in 
> AB ... If you are going to provide this capability, please do so in 
> a manner that one can take advantage of ALL the information that 
> would be the product of performing an FFT i.e. both the real & 
> imaginary arrays or a single array of complex numbers and the 
> ability to deal with complex numbers in AFL. This is needed not 
> only to get amplitudes at particular frequencies but also phase 
> shift and power.
> 
> PPS ... IMHO a DFT type implementation that does not require the 
> data being anaylized to be a power of 2 in length would be superior 
> to a Cooley-Tukey implementation even if run time is a little 
> longer ...
> 
> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> 
ps.com,
> "Tomasz Janeczko" <groups@> 
> wrote:
> >
> > For that you need Fourier transform and FFT is coming as a built 
> in function in 4.86
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "Fred" <ftonetti@>
> > To: <amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> 
ps.com>
> > Sent: Friday, October 06, 2006 3:48 AM
> > Subject: [amibroker] Re: Polynomial Trendlines
> > 
> > 
> > > Now if someone can take this method and/or AFL or at least 
> provide a 
> > > how to that takes us into Trigometric curve fitting and 
> extrapolation 
> > > i.e. the solution of simultaneous equations in the generalized 
> format 
> > > of a spectral model i.e. ...
> > > 
> > > S ~ (a1 cos w1t + b1 sin w1t) + ... + (Am cos wm + bm sin wmt)
> > > 
> > > Then we might have something fairly useful ...
> > > 
> > > I suspect Gaussian Elimiation can be used for this as well, but 
> I 
> > > don't have the skill level to calculate the necessary matrix 
> entries 
> > > to get it down ...
> > > 
> > > Any mathematicians out there ?
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> 
ps.com,
> "Fred" <ftonetti@> wrote:
> > >>
> > >> When stretch over enough data almost any order will become a 
> pseudo 
> > >> straight line ...
> > >> 
> > >> By their nature a first order IS a straight line, 2nd U shape, 
> 3rd 
> > >> order sine wave etc ...
> > >> 
> > >> Try highlighting a SMALLER segment of data by using the 
> beginning 
> > > and 
> > >> ending range markers ...
> > >> 
> > >> 
> > >> --- In amibroker@xxxxxxxxx <mailto:amibroker%
40yahoogroups.com> ps.com,
> "d_hanegan" <dhanegan@> wrote:
> > >> >
> > >> > Fred:
> > >> > 
> > >> > Thanks for your posts and all of the information concerning 
> the 
> > >> > Polynomial Trendlines. When I run the code, I pretty much 
> just 
> > > get 
> > >> > a straight green line; it does not fit my data. I thought I 
> had 
> > >> > read all of the posts. Am I missing something? 
> > >> > 
> > >> > Thanks.
> > >> > 
> > >> > Dan
> > >> > --- In amibroker@xxxxxxxxx <mailto:amibroker%
40yahoogroups.com>
> ps.com, "Fred" <ftonetti@> wrote:
> > >> > >
> > >> > > Be AWARE ... that was a hand picked image ... if you play 
> with 
> > >> > > PolyFit you will see that sometimes data fits the 
> > > extrapolations, 
> > >> > > sometimes it doesn't.
> > >> > > 
> > >> > > The higher the order, the flakier the extrapolations are 
> likely 
> > >> to 
> > >> > > become ...
> > >> > > 
> > >> > > So ... Remember what it is ... a generator of an equation 
> in 
> > > the 
> > >> > form 
> > >> > > 
> > >> > > Y = a + bx + cx^2 + ... + nx^(n-1)
> > >> > > 
> > >> > > Where the coeeficients were pick to fit the data.
> > >> > > 
> > >> > > IMHO what PolyFit is, epecially with very high orders is a 
> very 
> > >> > good 
> > >> > > detrender of IN SAMPLE data, nothing more, nothing 
less ... 
> > > That 
> > >> > in 
> > >> > > and of itself is a useful tool ... Gaussian Elimination 
can 
> > > also 
> > >> > be 
> > >> > > the basis for some other things that are pretty decent 
when 
> the 
> > >> > order 
> > >> > > is kept fairly low i.e. 3 or 4 ...
> > >> > > 
> > >> > > --- In amibroker@xxxxxxxxx <mailto:amibroker%
40yahoogroups.com>
> ps.com, "Ara Kaloustian" <ara1@> 
> > > wrote:
> > >> > > >
> > >> > > > Polynomial TrendlinesFred,
> > >> > > > 
> > >> > > > There have been a lot of posting on this subject. Your 
> one 
> > >> > image 
> > >> > > however is a very powerful message of its potential.
> > >> > > > 
> > >> > > > Now I have to go back and review all the post ... hoping 
> to 
> > >> find 
> > >> > a 
> > >> > > good reference to study.
> > >> > > > 
> > >> > > > Anyone using it succesfully now?
> > >> > > > 
> > >> > > > Ara
> > >> > > > ----- Original Message ----- 
> > >> > > > From: Fred Tonetti 
> > >> > > > To: amibroker@xxxxxxxxx <mailto:amibroker%
40yahoogroups.com>
> ps.com 
> > >> > > > Sent: Tuesday, October 03, 2006 3:32 PM
> > >> > > > Subject: [amibroker] RE: Polynomial Trendlines
> > >> > > > 
> > >> > > > 
> > >> > > > Oops .
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > Meant to include this visual .
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > Green is calculated . White is extrapolated .
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > 
> > >> > > > ---------------------------------------------------------
-
> ----
> > > --
> > >> -
> > >> > ---
> > >> > > ----------
> > >> > > > I am using the free version of SPAMfighter for private 
> > > users.
> > >> > > > It has removed 8588 spam emails to date.
> > >> > > > Paying users do not have this message in their emails.
> > >> > > > Try SPAMfighter for free now!
> > >> > > >
> > >> > >
> > >> >
> > >>
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 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.amibroke <http://www.amibroker.com/support.html>
> r.com/support.html
> > > 
> > > 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> >
>




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006