Resampling Filter Pack [DW]

This is an experimental study that calculates filter values at user defined sample rates.
This study is aimed to provide users with alternative functions for filtering price at custom sample rates.

First, source data is resampled using the desired rate and cycle offset. The highest possible rate is 1 bar per sample ( BPS ).
There are three resampling methods to choose from:
-> BPS - Resamples based on the number of bars.
-> Interval - Resamples based on time in multiples of current charting timeframe.
-> PA - Resamples based on changes in price action by a specified size. The PA algorithm in this script is derived from my Range Filter algorithm.
The range for PA method can be sized in points, pips, ticks, % of price, ATR, average change, and absolute quantity.

Then, the data is passed through one of my custom built filter functions designed to calculate filter values upon trigger conditions rather than bars.
In this study, these functions are used to calculate resampled prices based on bar rates, but they can be used and modified for a number of purposes.
The available conditional sampling filters in this study are:
-> Simple Moving Average ( SMA )
-> Exponential Moving Average ( EMA )
-> Zero Lag Exponential Moving Average ( ZLEMA )
-> Double Exponential Moving Average ( DEMA )
-> Rolling Moving Average (RMA)
-> Weighted Moving Average ( WMA )
-> Hull Moving Average ( HMA )
-> Exponentially Weighted Hull Moving Average (EWHMA)
-> Two Pole Butterworth Low Pass Filter (BLP)
-> Two Pole Gaussian Low Pass Filter (GLP)
-> Super Smoother Filter ( SSF )

Downsampling is a powerful filtering approach that can be applied in numerous ways. However, it does suffer from a trade off, like most studies do.
Reducing the sample rate will completely eliminate certain levels of noise, at the cost of some spectral distortion. The lower your sample rate is, the more distortion you'll see.
With that being said, for analyzing trends, downsampling may prove to be one of your best friends!
Note di rilascio: Updates:

-> All of the filter functions have been completely overhauled for enhanced performance, reliability, and versatility.
Rather than the previous sampling methods, these functions are using the array data structures Pine now provides.
These updated functions make downsampling convolution filters incredibly feasible, thus fixing calculation errors in SMA and WMA from the previous version.

-> Thanks to array processing, the current sample and valuewhen functions are no longer needed, so they have been removed.

-> Added Volume Weighted Moving Average (VWMA) with tick volume substitution for NaN values, and Arnaud Legoux Moving Average (ALMA) to the list of available filter types to choose from.

-> Added a custom bar color scheme based on disparity and direction for easier, and more visually appealing, analysis.
Note di rilascio: Updates:

- Fixed VWMA delay in weights

- Fixed Interval resampling method variable assignment
Note di rilascio: Update:

Fixed issue with range smoothing parameters not being connected in the PA based new sample function.
Thank you @mdvmdv for bringing this issue to my attention!
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?
For my full list of premium tools, check the blog:

Reach out on Telegram:


Wished I would have found your work months ago! Thanks again dude!
500 coin
+1 Rispondi
500 coin
+1 Rispondi
This publication is now featured in our Editors' Picks. In the name of all TradingView traders, thank you for your valuable contribution to the TradingView community, and congrats!
+8 Rispondi
thanks for sharing this great work! it would be very interesting to combine novel moving averages together with filters ;)
+6 Rispondi
Hey guys, regarding this setup can someone please clarify what is the BUY/SELL signal

Much appreciated
+2 Rispondi
DonovanWall Salman49
@Salman49, This utility does not have specific buy and sell signals built into it.

This is designed to provide alternative functions for filters that utilize custom sample rates rather than sampling data on every bar. Think of it as an "enhanced" set of moving averages.

How you analyze and trade with this utility depends on your personal preferences.
What setting do you set it to so that alerts trigger a buy or sell-off of the changing green/red line?
+2 Rispondi
@mbver, For color switch alerts, all you need to do is set up a couple alert conditions using the filter_dir variable in the code. This holds the direction state that powers the color scheme.

Simply take this snippet and paste it to the bottom of your code.

Then you'll be able to access the conditions from your alert creation interface using the conditions "Bullish Switch" and "Bearish Switch", or whatever you choose to name them.
+1 Rispondi
mbver DonovanWall
@DonovanWall, Thank you! really appreciate the help. Does the color switching repaint at all also?
+1 Rispondi
@mbver, Nope. Once closed, the colors will remain constant.
+3 Rispondi
Home Screener azioni Screener forex Screener cripto Calendario economico Su di noi Caratteristiche Grafico Costi Invita un amico Regolamento Centro di supporto Soluzioni per broker & siti web Widget Librerie grafiche Libreria grafica leggera Blog & Novità Twitter
Profilo Impostazioni profilo Account e fatturazione Amici invitati Coin I miei ticket di supporto Centro di supporto Messaggi Privati Chat Esci