PureBytes Links
Trading Reference Links
|
I have written a least squares fit to a quadratic equation. It was
quite difficult due to the computation of the coefficient of the x^2
term. The problem is that AB uses single precision math, and the
computation would 'blow up' every so often because the coeff of x^2 is
the difference between two very large numbers.
I used the technique of Gaussian Elimination and had to create a
separate time base to prevent the 'blow up's.
Then, if you want to do backtesting, it is necessary to extract arrays
of price data n-days back, then align and load them in with the
artificial time base array before you start the Gauss. It is really
quite messy, but I was able to make it work eventually.
So of course the REAL question is if it works better than - say - a
linear regression which Tomasz has kindly pre-programmed for us.
Being slightly 'bendy' because it is a section of a parabola, entries
occur a bar or two earlier, and exits are similarly. Whipsaws are
also a little increase because of the flexability. In all, it works
better than a linear regression, but not a lot better.
The code is not available - as it is used commercially.
ReefBreak
--- In amibroker@xxxxxxxxxxxxxxx, "d_hanegan" <dhanegan@xxx> wrote:
>
> Hello All:
>
> Sigma Bands aside, has anyone seen or done any work on nth order
> Polynomial Trendlines?
>
> Thanks.
>
> Dan
>
|