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

업데이트됨
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.

릴리즈 노트:
Fixed coloration on the forecast bars.
릴리즈 노트:
Changed plot to line and cleaned up coordinate drawing functions.
Cleaned up inputs
Added bar coloring muting to better identify trend on chart
릴리즈 노트:
One more small cleanup on coordinates.
릴리즈 노트:
Display chart cleanup.
릴리즈 노트:
Fixed small line error
릴리즈 노트:
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 line width settings for both past and forecast bars
릴리즈 노트:
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.