Quick Search
»

# Kalman

### Syntax

```public Kalman(DataSeries source, string description)
public static Kalman Series(DataSeries source)```

### Parameter Description

 source The source DataSeries

### Description

Kalman
The Kalman Filter is based on the concept of optimum estimation, first introduced by Dr. R. E. Kalman in 1960. It has generally been used in terrestrial and space-based navigation and tracking systems. In general, it can be thought of as generating an optimal (in a linear, white noise, mean-square-error sense) estimate of a future position based on the current position of a target and an estimate of its velocity and acceleration and their uncertainties.

### Interpretation

Where DataSeries are involved as in trading systems the mathematics can be simplified considerably and a (nearly) zero lag filter produced very straightforwardly. For further information see: Optimal Tracking Filters (DOC file) by John Ehlers of MESA Software. Note that Kalman filters can be applied to any DataSeries.

### Calculation

The basic pseudo computation for the Kalman Filter value at a specific bar for a DataSeries is:

 ZeroLagValueBar= Weight1 * DataSeriesValueBar + Weight2 * (DataSeriesValueBar - DataSeriesValueBar - 3) ZeroLagValueBar= ZeroLagValueBar + Weight3 * ZeroLagValueLast ZeroLagValueLast= ZeroLagValueBar Save KalmanSeriesValueBar= ZeroLagValueBar return KalmanSeriesValueBar

### Example

This system uses the Kalman Filter as a signal line for the CMO Oscillator to time position entries

```
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;namespace WealthLab.Strategies
{
public class KalmanDemo : WealthScript
{
protected override void Execute()
{
DataSeries Average = ( High + Low ) / 2;
DataSeries hCMO = CMO.Series( Average, 14 );
ChartPane CMOPane = CreatePane( 40, true, true );
PlotSeries( CMOPane, hCMO, Color.Blue, LineStyle.Solid, 3 );
PlotSeries( CMOPane, Kalman.Series( hCMO ), Color.Black, LineStyle.Solid, 2 );			for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
if( CrossOver( bar, hCMO, 0 ) )
SellAtMarket( bar+1, LastPosition, "CMO 0" );
}
else
{
if( ( CMO.Value( bar-1, Average, 14 ) < -50 ) & CrossOver( bar, hCMO, Kalman.Series( hCMO ) ) )
BuyAtMarket( bar+1, "CMO Kalman" );
}
}
}
}
}
```
 Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

ScrewTurn Wiki. Some of the icons created by FamFamFam.