TradingView
loxx
5 Th08 2022 06:02

Fourier Extrapolator of Price w/ Projection Forecast [Loxx] 

GOLD (US$/OZ)TVC

Mô tả

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.













Phát hành các Ghi chú

Fixed coloration on the forecast bars.

Phát hành các Ghi chú

Changed plot to line and cleaned up coordinate drawing functions.
Cleaned up inputs
Added bar coloring muting to better identify trend on chart

Phát hành các Ghi chú

One more small cleanup on coordinates.

Phát hành các Ghi chú

Display chart cleanup.

Phát hành các Ghi chú

Fixed small line error

Phát hành các Ghi chú

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

Phát hành các Ghi chú

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.
Bình luận
HS_TA_
@loxx -Great! Please change it so calculation of Harmonic Period ("HP") is *adaptive* (iterative) at each new bar. Improves the forecast.
PineCoders
RicardoSantos
thanks for sharing :)
loxx
@RicardoSantos, thank you kind sir
CheeGuevaraa
Tnx Mr. Loxx i get more confidence now. and cautious to enter and exit .tnx lot
f1l1per.
DDMyke
herodes2pilatos
Thanks for your work!
Mrsfiend
which timeframe is best for daytrading? 5 or 15min?
El-Nino
@loxx Thanks for this, on which timeframe would you say its most accurate? I flipped it from Daily chart to 4hr and the readings are not similar at all
Thêm nữa