TradingView
loxx
6 de Ago de 2022 21:45

Fourier Extrapolation of Variety Moving Averages [Loxx] 

Bitcoin / TetherUSBinance

Descrição

Fourier Extrapolation of Variety Moving Averages is a Fourier Extrapolation (forecasting) indicator that has for inputs 38 different types of moving averages along with 33 different types of sources for those moving averages. This is a forecasting indicator of the selected moving average of the selected price of the underlying ticker. This indicator will repaint, so past signals are only as valid as the current bar. This indicator allows for up to 1500 bars between past bars and future projection bars. If the indicator won't load on your chart. check the error message for details on how to fix that, but you must ensure that past bars + futures bars is equal to or less than 1500.

Fourier Extrapolation using the Quinn-Fernandes algorithm is one of several (5-10) methods of signals forecasting that I'l be demonstrating in Pine Script.

What is Fourier Extrapolation?
This indicator uses a multi-harmonic (or multi-tone) trigonometric model of a price series xi, i=1..n, is given by:

xi = m + Sum( a*Cos(w*i) + b*Sin(w*i), h=1..H )

Where:

xi - past price at i-th bar, total n past prices;
m - bias;
a and b - scaling coefficients of harmonics;
w - frequency of a harmonic ;
h - harmonic number;
H - total number of fitted harmonics.

Fitting this model means finding m, a, b, and w that make the modeled values to be close to real values. Finding the harmonic frequencies w is the most difficult part of fitting a trigonometric model. In the case of a Fourier series, these frequencies are set at 2*pi*h/n. But, the Fourier series extrapolation means simply repeating the n past prices into the future.

This indicator uses the Quinn-Fernandes algorithm to find the harmonic frequencies. It fits harmonics of the trigonometric series one by one until the specified total number of harmonics H is reached. After fitting a new harmonic , the coded algorithm computes the residue between the updated model and the real values and fits a new harmonic to the residue.

see here: A Fast Efficient Technique for the Estimation of Frequency , B. G. Quinn and J. M. Fernandes, Biometrika, Vol. 78, No. 3 (Sep., 1991), pp . 489-497 (9 pages) Published By: Oxford University Press

The indicator has the following input parameters:
src - input source
npast - number of past bars, to which trigonometric series is fitted;
Nfut - number of predicted future bars;
nharm - total number of harmonics in model;
frqtol - tolerance of frequency calculations.

Included:
  • Loxx's Expanded Source Types
  • Loxx's Moving Averages


Other indicators using this same method

Fourier Extrapolator of Variety RSI w/ Bollinger Bands [Loxx]
https://www.tradingview.com/script/pHlxm005-Fourier-Extrapolator-of-Variety-RSI-w-Bollinger-Bands-Loxx/

Fourier Extrapolator of Price w/ Projection Forecast
https://www.tradingview.com/script/u0r2gpti-Fourier-Extrapolator-of-Price-w-Projection-Forecast-Loxx/

Fourier Extrapolator of Price
https://www.tradingview.com/script/8gqRTSRR-Fourier-Extrapolator-of-Price-Loxx/

Loxx's Moving Averages: Detailed explanation of moving averages inside this indicator
https://www.tradingview.com/script/x6otWKAc-Moving-Average-Filters-Add-on-w-Expanded-Source-Types-Loxx/

Loxx's Expanded Source Types: Detailed explanation of source types used in this indicator
https://www.tradingview.com/script/AdBj6Sva-Better-Heiken-Ashi-Candles-w-Expanded-Source-Types-Loxx/

Notas de Lançamento

Changed plot to line and cleaned up coordinate drawing functions.

Notas de Lançamento

Coordinate cleanup
Comentários
peacefulLizard50262
labtab
Thank you for advancing the work on Fourier framework and bringing it into Tradingview. A few attempts were made earlier, but your work is most closer to the user's need. Thank you so much for your generosity and sharing it with us. We are grateful for all your master acts.
tanhio
What does yellow and fuchsia mean in the projection?
loxx
@tanhio, yellow = uptrend, fuchsia = downtrend, both are projections, obviously
tanhio
@loxx, thank you
OutsourcE
Could you try it with zigzag instead of ampty of smas?
fvideira
fascinating work, keep it up
code_a_r
amazing work, thanks!
Mais