API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Visualizers |

**Main Page**- Category List
- Knowledge Base
- Tutorial Videos
- Traders Tips
- Indicator documentation
- Addin examples

Advanced Search »

```
DataSeries Butterworth2( DataSeries Series, int Period)
DataSeries Butterworth3( DataSeries Series, int Period)
```

Series |
A price series |

Period |
The critical period of the filter |

This filter can be used for smoothing. It rejects high frequencies (fast movements) better than an EMA and has lower lag. This filter is maximally smooth at zero frequency. Published by John F. Ehlers in "Rocket Science For Traders, Digital Signal Processing Applications"; original implementation by DrKoch, translation to WL5 by Eugene

Price movements (cycles) with this

From Ehlers Book:

"The first objective of using smoothers is to eliminate or reduce the undesired high-frequency components in th eprice data. Therefore these smoothers are called low-pass filters, and they all work by some form of averaging. Butterworth low-pass filtters con do this job, but nothing comes for free. A higher degree of filtering is necessarily accompanied by a larger amount of lag. We have come to see that is a fact of life."

The lag at low frequencies is:

N - Number of Poles, 2 for butterworth2, 3 for butterworth3 P - critical period of the filter

Lag is higher for higher frequencies, being worse close to the cutoff frequency of the filter.

Special initialization of filter stages ensures proper working in scans with as few bars as possible.

The lag at low frequencies is:

`Lag := N * P / pi^2`

N - Number of Poles, 2 for butterworth2, 3 for butterworth3 P - critical period of the filter

Lag is higher for higher frequencies, being worse close to the cutoff frequency of the filter.

Special initialization of filter stages ensures proper working in scans with as few bars as possible.

```
public class IIRDemo : WealthScript
{
private StrategyParameter per2;
private StrategyParameter per3;
public IIRDemo()
{
per2 = CreateParameter("2pole period", 14, 2, 200, 2 );
per3 = CreateParameter("3pole period", 14, 3, 300, 3 );
}
protected override void Execute()
{
Butterworth2 bw2 = Butterworth2.Series(Bars.Close, per2.ValueInt);
Butterworth3 bw3 = Butterworth3.Series(Bars.Close, per3.ValueInt);
PlotSeries( PricePane, bw2, Color.Green, LineStyle.Solid, 2 );
PlotSeries( PricePane, bw3, Color.Red, LineStyle.Solid, 2 );
}
}
```