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/
نص برمجي مفتوح المصدر

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

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

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

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