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

Re: low-lag smoothing filter fitting problem



PureBytes Links

Trading Reference Links

I'd suggest you use the objective function

f(fitting params) = (TRACKLENGTH * SYE * SXE)

and plug that into your general purpose nonlinear
minimization package.  (I like the polytope method
a/k/a "simplex" method of Nelder and Mead, source
code found in _Numerical_Recipes_ by Press et al,
but any of a zillion packages would do the
same job equally well.)

The idea is: you want your filter output to be
   1. smooth
   2. low-lag
   3. a good fit

so the objective function measures non-smoothness,
lag, and badness of fit.  At minima of the objective
function, your filter is smooth and low lag and
a good fit.

TRACKLENGTH is a simple way to measure non-smoothness

SYE is the sum of the (squared) errors in the
Y dimension, which is a simple way to measure
the badness of fit

SXE is the sum of the (squared) errors in the
X dimension, which is a simple way to measure lag

SXE will be messy tricky to compute because you'll
have to interpolate, either the original data or
else the filter output.

You could also incorporate penalty functions
and/or barrier functions, to steer away from
zones in parameter-space that exhibit behavior
you don't like, such as ringing, overshoot,
thermal tails, etc.

Mark Johnson