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

Oscillator



PureBytes Links

Trading Reference Links

Just thought I might contribute a little piece of code to the list.

This is an oscillator that simply plots the difference between two
Kalman filters. Questions or comments will be appreciated. 

I have also attached the ela file for those unable to paste in code.

Hope this is useful to some of you, Randall

**********************************************************************

Inputs:K1(2200),K2(400),Price1((((H+L)/2)+C)/2-(Average(Range,3)/2)),Price2(L);
Var:DeltaK1(0),Pred1(0),Smooth1(0),Velo1(0),KF1(0),DeltaK2(0),Pred2(0),Smooth2(0),Velo2(0),KF2(0),KFOsc(0);

   IF currentbar > 1 then BEGIN

	DeltaK1 = Price1 -Pred1;
	Smooth1 = Pred1 + DeltaK1* SquareRoot( (K1/10000)*2 ) ;
	Velo1= Velo1 + ((K1/10000)*Deltak1) ;
	Pred1 =  Smooth1 + Velo1 ;

	KF1=Pred1;
   END;

   IF currentbar > 1 then BEGIN

	DeltaK2 = Price2 -Pred2;
	Smooth2 = Pred2 + DeltaK2* SquareRoot( (K2/10000)*2 ) ;
	Velo2= Velo2 + ((K2/10000)*Deltak2) ;
	Pred2 =  Smooth2 + Velo2 ;

	KF2=Pred2;
   END;


      KFOsc=KF1-KF2;



   Plot1(KFOsc,"KFOsc");
   Plot2(0,"");
Attachment Converted: "c:\eudora\attach\Kfosc.ela"