loxx

Fourier Extrapolator of Price w/ Projection Forecast [Loxx]

loxx Atualizado   
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.













Notas de Lançamento:
Fixed coloration on the forecast bars.
Notas de Lançamento:
Changed plot to line and cleaned up coordinate drawing functions.
Cleaned up inputs
Added bar coloring muting to better identify trend on chart
Notas de Lançamento:
One more small cleanup on coordinates.
Notas de Lançamento:
Display chart cleanup.
Notas de Lançamento:
Fixed small line error
Notas de Lançamento:
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
Notas de Lançamento:
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.

Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: www.patreon.com/algxtrading/membership
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?