Mauro60
09-13-2007, 07:37 AM
this is a tradestation function code,is some experienced of C# able to do its porting?
{Function = Kalman Filter}
{Use gain between 500 to 1000 for starters...}
Inputs: price(NumericSeries), gain(Numeric);
Vars: Pred(price), Smooth(0), Velo(0), DeltaK(0), stderr(0),
error(0), sumerr(0) ;
if currentbar > 1 then
begin
DeltaK = price - Pred;
Smooth = Pred + DeltaK* SquareRoot((gain / 10000) * 2) ;
Velo= Velo + ((gain / 10000) * Deltak) ;
Pred = Smooth + Velo ;
KF=Pred;
end;
{Function = Kalman Filter}
{Use gain between 500 to 1000 for starters...}
Inputs: price(NumericSeries), gain(Numeric);
Vars: Pred(price), Smooth(0), Velo(0), DeltaK(0), stderr(0),
error(0), sumerr(0) ;
if currentbar > 1 then
begin
DeltaK = price - Pred;
Smooth = Pred + DeltaK* SquareRoot((gain / 10000) * 2) ;
Velo= Velo + ((gain / 10000) * Deltak) ;
Pred = Smooth + Velo ;
KF=Pred;
end;