OPEN-SOURCE SCRIPT

STD/Clutter-Filtered, Variety FIR Filters [Loxx]

STD/Clutter-Filtered, Variety FIR Filters [Loxx] is a FIR filter explorer. The following FIR Digital Filters are included.

  • Rectangular - simple moving average
  • Hanning
  • Hamming
  • Blackman
  • Blackman/Harris
  • Linear weighted
  • Triangular


There are 10s of windowing functions like the ones listed above. This indicator will be updated over time as I create more windowing functions in Pine.

Uniform/Rectangular Window
The uniform window (also called the rectangular window) is a time window with unity amplitude for all time samples and has the same effect as not applying a window.

Use this window when leakage is not a concern, such as observing an entire transient signal.

The uniform window has a rectangular shape and does not attenuate any portion of the time record. It weights all parts of the time record equally. Because the uniform window does not force the signal to appear periodic in the time record, it is generally used only with functions that are already periodic within a time record, such as transients and bursts.

The uniform window is sometimes called a transient or boxcar window.

For sine waves that are exactly periodic within a time record, using the uniform window allows you to measure the amplitude exactly (to within hardware specifications) from the Spectrum trace.

Hanning Window
The Hanning window attenuates the input signal at both ends of the time record to zero. This forces the signal to appear periodic. The Hanning window offers good frequency resolution at the expense of some amplitude accuracy.

This window is typically used for broadband signals such as random noise. This window should not be used for burst or chirp source types or other strictly periodic signals. The Hanning window is sometimes called the Hann window or random window.

Hamming Window
Computers can't do computations with an infinite number of data points, so all signals are "cut off" at either end. This causes the ripple on either side of the peak that you see. The hamming window reduces this ripple, giving you a more accurate idea of the original signal's frequency spectrum.

Blackman
The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window.

Blackman-Harris
This is the original "Minimum 4-sample Blackman-Harris" window, as given in the classic window paper by Fredric Harris "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform", Proceedings of the IEEE, vol 66, no. 1, pp. 51-83, January 1978. The maximum side-lobe level is -92.00974072 dB.

Linear Weighted
A Weighted Moving Average puts more weight on recent data and less on past data. This is done by multiplying each bar’s price by a weighting factor. Because of its unique calculation, WMA will follow prices more closely than a corresponding Simple Moving Average.

Triangular Weighted
Triangular windowing is known for very smooth results. The weights in the triangular moving average are adding more weight to central values of the averaged data. Hence the coefficients are specifically distributed. Some of the examples that can give a clear picture of the coefficients progression:

period 1 : 1
period 2 : 1 1
period 3 : 1 2 1
period 4 : 1 2 2 1
period 5 : 1 2 3 2 1
period 6 : 1 2 3 3 2 1
period 7 : 1 2 3 4 3 2 1
period 8 : 1 2 3 4 4 3 2 1

Read here to read about how each of these filters compare with each other: Windowing

What is a Finite Impulse Response Filter?
In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying).

The impulse response (that is, the output in response to a Kronecker delta input) of an Nth-order discrete-time FIR filter lasts exactly {\displaystyle N+1}N+1 samples (from first nonzero element through last nonzero element) before it then settles to zero.

FIR filters can be discrete-time or continuous-time, and digital or analog.

A FIR filter is (similar to, or) just a weighted moving average filter, where (unlike a typical equally weighted moving average filter) the weights of each delay tap are not constrained to be identical or even of the same sign. By changing various values in the array of weights (the impulse response, or time shifted and sampled version of the same), the frequency response of a FIR filter can be completely changed.

An FIR filter simply CONVOLVES the input time series (price data) with its IMPULSE RESPONSE. The impulse response is just a set of weights (or "coefficients") that multiply each data point. Then you just add up all the products and divide by the sum of the weights and that is it; e.g., for a 10-bar SMA you just add up 10 bars of price data (each multiplied by 1) and divide by 10. For a weighted-MA you add up the product of the price data with triangular-number weights and divide by the total weight.

Ultra Low Lag Moving Average's weights are designed to have MAXIMUM possible smoothing and MINIMUM possible lag compatible with as-flat-as-possible phase response.

What is a Clutter Filter?
For our purposes here, this is a filter that compares the slope of the trading filter output to a threshold to determine whether to shift trends. If the slope is up but the slope doesn't exceed the threshold, then the color is gray and this indicates a chop zone. If the slope is down but the slope doesn't exceed the threshold, then the color is gray and this indicates a chop zone. Alternatively if either up or down slope exceeds the threshold then the trend turns green for up and red for down. Fro demonstration purposes, an EMA is used as the moving average. This acts to reduce the noise in the signal.

Included
  • Bar coloring
  • Loxx's Expanded Source Types
  • Signals
  • Alerts


Related Indicators

STD/Clutter-Filtered, Kaiser Window FIR Digital Filter [Loxx]
STD/Clutter-Filtered, Kaiser Window FIR Digital Filter [Loxx]


STD- and Clutter-Filtered, Non-Lag Moving Average
STD- and Clutter-Filtered, Non-Lag Moving Average [Loxx]


Clutter-Filtered, D-Lag Reducer, Spec. Ops FIR Filter
Clutter-Filtered, D-Lag Reducer, Spec. Ops FIR Filter [Loxx]


STD-Filtered, Ultra Low Lag Moving Average
STD-Filtered, Ultra Low Lag Moving Average [Loxx]
blackmanblackmanharrisFIRfirfilterhamminghanningMoving Averagesrectangulartriangular

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟


Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
يعمل أيضًا:

إخلاء المسؤولية