yatrader2

FUNCTION: Goertzel algorithm -- DFT of a specific frequency bin

This function implements the Goertzel algorithm (for integer N).

The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT).

In short, it measure the power of a specific frequency like one bin of a DFT, over a rolling window (N) of samples.

Here you see an input signal that changes frequency and amplitude (from 7 bars to 17). I am running the indicator 3 times to show it measuring both frequencies and one in between (13). You can see it very accurately measures the signals present and their power, but is noisy in the transition. Changing the block len will cause it to be more responsive but noisier.

Here is a picture of the same signal, but with white noise added.

If you have a cycle you think is present you could use this to test it, but the function is designed for integration in to more complicated scripts. I think power is best interrupted on a log scale.

Given a period (in bars or samples) and a block_len (N in Goertzel terminology) the function returns the Real (InPhase) and Quadrature (Imaginary) components of your signal as well as calculating the power and the instantaneous angle (in radians).

I hope this proves useful to the DSP folks here.
Mã nguồn mở

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 đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?