Skip to content
All library documents

Resampling Price Data for Conditional Moving-Average and Low-Pass Filters

Article TradingView scripts

Summary

This indicator framework samples price on user-defined events rather than necessarily processing every chart bar. It offers bar-count sampling, time-interval sampling, and price-action sampling, with the latter triggered by moves sized in points, pips, ticks, percentage terms, ATR, average change, or absolute units. After sampling, a selected moving average or low-pass filter updates only when a sampling condition occurs. The available options include common averages as well as Butterworth, Gaussian, and Super Smoother filters.

The indicator plots the sampled source and filtered value, colors the filter by its direction, and can color bars using direction and price disparity. Its central analytical trade-off is that reducing the sample rate can remove noise while introducing spectral distortion, which grows as sampling becomes sparser. The document presents the tool as experimental and useful for trend analysis, but supplies no trading rules or performance tests. Users must choose sample rates and filter parameters for their data and assess the resulting lag and distortion themselves.

Key ideas

  • Sampling can be triggered by bar counts, time intervals, or price-action changes of a chosen size.
  • Conditional filters update on sample events and include moving averages and several low-pass filter designs.
  • Price-action thresholds can use fixed units or dynamic measures such as ATR and average change.
  • Lower sampling rates may suppress noise but increase spectral distortion.
  • The indicator visualizes sampled prices and filter direction but does not establish a profitable trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.