Selezione editorialeOPEN-SOURCE SCRIPT

# Fourier Extrapolator of Price w/ Projection Forecast [Loxx]

Aggiornato
Due to popular demand, I'm pusblishing Fourier Extrapolator of Price w/ Projection Forecast.. As stated in it's twin indicator, this one is also 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.

The indicator plots two curves: the green/red curve indicates modeled past values and the yellow/fuchsia curve indicates the modeled future values.

The purpose of this indicator is to showcase the Fourier Extrapolator method to be used in future indicators.

Note di rilascio
Fixed coloration on the forecast bars.
Note di rilascio
Changed plot to line and cleaned up coordinate drawing functions.
Cleaned up inputs
Added bar coloring muting to better identify trend on chart
Note di rilascio
One more small cleanup on coordinates.
Note di rilascio
Display chart cleanup.
Note di rilascio
Fixed small line error
Note di rilascio
Big update.
Added the ability to start the forecast from X bars backward so you can see past forecast accuracy, this is now the "Bars back to start forecast" setting. The original bars back setting has been changed to "Calculation bars"
Added more coloring options
Added line width settings for both past and forecast bars
Note di rilascio
Fixed colors. Added dotted lines to the forecast line so you can better tell between past and forecast. The yellow is uptrend in forecast bars, the fuchsia is down trend in forecast bars.
educationalfernandesforecastingfourierfouriertransformfrequencyHarmonic Patternsleastsquaresprojectionquinn
Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership

## Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.