Show/Hide Toolbars

mesaForecaster for TradingView

Navigation: » No topics above this level «

Windowing Functions

Scroll Prev Top Next More

In the indicator menu you can select from different Windowing functions to apply to the input data prior to performing any of the cycle-based analyses (does not apply to the Plot Forecast option).  A windowing function simply mitigates spectral leakage by tapering the edges of a finite-length signal segment to reduce discontinuities. You can select from rectangular, hanning, hamming, blackman, blackmanHarris, and parzen and all of these are discussed in more detail below:

 

Rectangular Window

 

The rectangular window is the simplest windowing function, which essentially means not applying any window at all. Mathematically, every data point in the sequence is multiplied by 1. Imagine listening to a song start abruptly and end abruptly; that's what a rectangular window does to a signal. It doesn't modify the original values but can lead to abrupt starts and ends in the data.

 

 

Hamming Window

 

The Hamming window tapers off the start and end of a signal smoothly, minimizing sudden jumps. Its formula is:

 

w(n) = 0.54 - 0.46 * cos(2*PI*n/N-1)

 

Imagine gently fading a song in at the start and fading it out at the end; that's the effect of the Hamming window.

 

 

Hanning Window

 

Named after Julius von Hann, the Hanning window, sometimes just called the Hann window, is similar to the Hamming window but with a slightly different shape. It's given by the formula:

 

w(n) = 0.5 * (1.0 - cos(2*PI*n/N-1))

 

Think of it as another way of fading a song smoothly at the beginning and end, but with a different fade curve than the Hamming.

 

 

Blackman Window

 

The Blackman window provides even more tapering than the Hamming or Hanning windows. It's often used when precision is key, especially in reducing the side lobes (unwanted ripples) in the frequency response. The formula is:

 

w(n) = 0.42 - 0.5 * cos(2*PI*n/N-1) + 0.08 * cos(4.0*PI*n/N-1)

 

Imagine it as a deeper, more pronounced fade-in and fade-out for a song.

 

 

Blackman-Harris Window

 

The Blackman-Harris window is a refinement of the Blackman window that offers even better frequency resolution. It’s like using an enhanced filter to smooth out the edges of a signal even more delicately, making sure there's minimal distortion. It involves a more complex mathematical formula with four cosine terms.

 

 

Parzen Window

 

The Parzen window offers a unique shape that falls between the rectangular and the Hanning window. It tends to preserve signal features better in certain applications. It’s like gently easing into a song but with a particular curve that keeps more of the song's original character. Its formula involves piecewise-defined cubic polynomials based on the distance from the center of the window.

 

 

In all these cases, the "song" analogy is a metaphor for any data signal, and the window functions are simply methods for emphasizing or de-emphasizing certain parts of that signal. You should experiment with the different windowing functions, and the spectrum plot is a good way to quickly visualize the differences. In general, either the Hamming or Hanning windowing functions should perform well, while the others might provide a benefit in special situations, such as a signal where there are several strong cycles situated in close proximity.

 

 


See Also:

 

Settings

© 2023 Divergence Software, Inc.