PineCodersTASC

TASC 2023.04 Undersampled Double MA

█ OVERVIEW

TASC's April 2023 edition of Traders' Tips features an article entitled "Just Ignore Them: Undersampling The Data As A Smoothing Technique" by John ​Ehlers, which explores a method for reducing noise through data sampling. This script implements the article's proposed Undersampled Double MA indicator.

█ CONCEPTS

The conventional approach to reducing the impact of noise in the market data on trading rules is to use smoothing filters like moving averages. However, John ​Ehlers suggests that changing the sample rate of the datastream is a simple and effective way to smooth the data and reduce noise. Specifically, he argues that undersampling the data removes high-frequency components contributing to noisiness. Notably, the elimination of these components produces less lag than that of conventional smoothing filters.

The Undersampled Double MA indicator implemented in this script represents a practical application of smoothing with undersampling. It samples the data at a given rate (for instance, once every five bars, as suggested by ​Ehlers), then processes the resulting data using a Hann window filter with two different periods, producing two smooth data streams that traders can use in the same way as the combination of two conventional moving averages of different lengths (i.e., fast and slow MAs).

█ CALCULATIONS

The script samples data once every Nth bar (by default, N = 5) and smooths the undersampled data with 6-period and 12-period Hann filters, which it plots on the main chart. Users can adjust the sampling period and the periods of each Hann filter to their liking from the inputs in the script settings.

Tools and ideas for all Pine coders: www.tradingview.com/u/PineCoders/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
TASC: traders.com/
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.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?