OPEN-SOURCE SCRIPT

Fourier Extrapolator of 'Caterpillar' SSA of Price [Loxx]

Fourier Extrapolator of 'Caterpillar' SSA of Price [Loxx] is a forecasting indicator that applies Singular Spectrum Analysis to input price and then injects that transformed value into the Quinn-Fernandes Fourier Transform algorithm to generate a price forecast. The indicator plots two curves: the green/red curve indicates modeled past values and the yellow/fuchsia dotted curve indicates the future extrapolated values.

What is the Fourier Transform Extrapolator of price?
Fourier Extrapolator of Price is 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.

Quinn-Fernandes algorithm find sthe 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

Fourier Transform Extrapolator of Price inputs are as follows:
  • npast - number of past bars, to which trigonometric series is fitted;
  • nharm - total number of harmonics in model;
  • frqtol - tolerance of frequency calculations.


What is Singular Spectrum Analysis ( SSA )?
Singular spectrum analysis ( SSA ) is a technique of time series analysis and forecasting. It combines elements of classical time series analysis, multivariate statistics, multivariate geometry, dynamical systems and signal processing. SSA aims at decomposing the original series into a sum of a small number of interpretable components such as a slowly varying trend, oscillatory components and a ‘structureless’ noise. It is based on the singular value decomposition ( SVD ) of a specific matrix constructed upon the time series. Neither a parametric model nor stationarity-type conditions have to be assumed for the time series. This makes SSA a model-free method and hence enables SSA to have a very wide range of applicability.

For our purposes here, we are only concerned with the "Caterpillar" SSA . This methodology was developed in the former Soviet Union independently (the ‘iron curtain effect’) of the mainstream SSA . The main difference between the main-stream SSA and the "Caterpillar" SSA is not in the algorithmic details but rather in the assumptions and in the emphasis in the study of SSA properties. To apply the mainstream SSA , one often needs to assume some kind of stationarity of the time series and think in terms of the "signal plus noise" model (where the noise is often assumed to be ‘red’). In the "Caterpillar" SSA , the main methodological stress is on separability (of one component of the series from another one) and neither the assumption of stationarity nor the model in the form "signal plus noise" are required.

"Caterpillar" SSA
The basic "Caterpillar" SSA algorithm for analyzing one-dimensional time series consists of:

Transformation of the one-dimensional time series to the trajectory matrix by means of a delay procedure (this gives the name to the whole technique);
Singular Value Decomposition of the trajectory matrix;
Reconstruction of the original time series based on a number of selected eigenvectors.

This decomposition initializes forecasting procedures for both the original time series and its components. The method can be naturally extended to multidimensional time series and to image processing.

The method is a powerful and useful tool of time series analysis in meteorology, hydrology, geophysics, climatology and, according to our experience, in economics, biology, physics, medicine and other sciences; that is, where short and long, one-dimensional and multidimensional, stationary and non-stationary, almost deterministic and noisy time series are to be analyzed.

"Caterpillar" SSA inputs are as follows:
  • lag - How much lag to introduce into the SSA algorithm, the higher this number the slower the process and smoother the signal
  • ncomp - Number of Computations or cycles of of the SSA algorithm; the higher the slower
  • ssapernorm - SSA Period Normalization
  • numbars =- number of past bars, to which SSA is fitted


Included:
  • Bar coloring
  • Alerts
  • Signals
  • Loxx's Expanded Source Types


Related Fourier Transform Indicators

Real-Fast Fourier Transform of Price w/ Linear Regression [Loxx]
Real-Fast Fourier Transform of Price w/ Linear Regression [Loxx]


Fourier Extrapolator of Variety RSI w/ Bollinger Bands [Loxx]
Fourier Extrapolator of Variety RSI w/ Bollinger Bands [Loxx]


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


Related Projection Forecast Indicators

Itakura-Saito Autoregressive Extrapolation of Price [Loxx]
Itakura-Saito Autoregressive Extrapolation of Price [Loxx]


Helme-Nikias Weighted Burg AR-SE Extra. of Price [Loxx]
Helme-Nikias Weighted Burg AR-SE Extra. of Price [Loxx]


Related SSA Indicators
End-pointed SSA of FDASMA [Loxx]
End-pointed SSA of FDASMA [Loxx]


End-pointed SSA of Williams %R [Loxx]
End-pointed SSA of Williams %R [Loxx]
caterpillarcaterpillarssaeducationalforecastforecastingfouriertransformMoving AveragesquinnquinnfernandessingularspectrumanalysisSSA

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
גם על:

כתב ויתור