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:
-> ( )
-> ( )
-> ( )
-> ( )
-> Rolling Moving Average (RMA)
-> ( )
-> ( )
-> Exponentially Weighted (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!
-> 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.
- Fixed VWMA delay in weights
- Fixed Interval resampling method variable assignment
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!
Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.