Fourier extrapolation of price - indicator for MetaTrader 5

Fourier extrapolation of price - indicator for MetaTrader 5

A multi-harmonic (or multi-tone) trigonometric model of a price series x[i], i=1..n, is given by:

x[i] = m + Sum( a[h]*Cos(w[h]*i) + b[h]*Sin(w[h]*i), h=1..H )


  • x[i] - past price at i-th bar, total n past prices;
  • m - bias;
  • a[h] and b[h] - scaling coefficients of harmonics;
  • w[h] - frequency of a harmonic;
  • h - harmonic number;
  • H - total number of fitted harmonics.

Fitting this model means finding m, a[h], b[h], and w[h] that make the modeled values to be close to real values. Finding the harmonic frequencies w[h] 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.

The indicator has the following input parameters:

  • Npast - number of past bars, to which trigonometric series is fitted;
  • Nfut - number of predicted future bars;
  • Nharm - total number of harmonics in model;
  • FreqTOL - tolerance of frequency calculations.

The indicator plots two curves: the blue curve indicates modeled past values and the red curve indicates the modeled future values.

Fourier extrapolation of price

Download Fourier extrapolation of price - indicator for MetaTrader 5

Related News

Latest News
Taiwan Stocks Will Soar to Record in 2020, Analysts Say
09.12.2019 21:06
(Bloomberg) -- This year’s unexpected 20% rally in Taiwan stocks is poised to close a final chapter in the history of its financial markets. The Taiex index is within 7% of its all-time high from 1990, a milestone that analysts say will likely be topped next year. That year marked the bursting of the bubble in Taiwan stocks, which had rallied even
Read more
Erdogan says Turkey to attain single-digit interest rates, inflation in 2020
09.12.2019 21:03
ANKARA (Reuters) - Turkey will attain single-digit interest rates and inflation in 2020, President Tayyip Erdogan told state broadcaster TRT Haber on Monday, adding this will pave the way for an increase in investments. Turkey's central bank has cut its policy interest rate by 10 percentage points since July to 14%. A Reuters poll last week
Read more
Trump says doing well with China in putting together trade deal
09.12.2019 20:27
WASHINGTON (Reuters) - President Donald Trump on Monday said the United States is doing well with China in hammering out a trade deal, as the clock ticks toward the levying of possible new tariffs on Chinese imports. U.S. tariffs on several consumer products, including mobile phones and toys, are set to kick in on Dec. 15, but there is hope the
Read more
Race to Run Bank of Canada Begins With Poloz Bowing Out in June
09.12.2019 20:24
(Bloomberg) -- Stephen Poloz’s announcement that he won’t seek a second term as governor of the Bank of Canada kicked off the guessing game on who will succeed him in June. The contest comes as the central bank stubbornly keeps the nation’s benchmark interest rate among the highest of all advanced economies, so one consideration for Prime Minister
Read more
Italy's TIM agrees deal with DAZN to stream sports
09.12.2019 20:21
MILAN (Reuters) - Telecom Italia (MI:TLIT) (TIM) said on Monday it agreed a deal with digital global sports provider DAZN Group that will enable Italy's biggest phone company to broadcast a wide range of sport events on its own video streaming platform TIM Vision. The tie-up follows similar moves by a growing number of telecoms firms hoping
Read more