PureBytes Links
Trading Reference Links
|
I have found that I seem to accomplish fairly good smoothing with a
limited amount of lag using a Kalman filter. I just tried this on the
code posted by Thomas Stridsman for the $%B indicator and thought
perhaps others might wish to do the same. Below is the function I use
for the Kalman filter. A good starting point for K1 is about 800.
Comments?
Regards, Randall
{Function name= KF}
INPUT: K1(Numeric), Price(NumericSeries);
VARS: Pred(BP), Smooth(0), Velo(0), DeltaK(0), stderr(0), error(0),
sumerr(0) ;
IF currentbar > 1 then BEGIN
DeltaK = BP -Pred;
Smooth = Pred + DeltaK* SquareRoot( (K1/10000)*2 ) ;
Velo= Velo + ((K1/10000)*Deltak) ;
Pred = Smooth + Velo ;
KF=Pred;
END;
|