Home Technical Indicator Post

Mastering Fourier Extrapolation in MetaTrader 5: Your Guide to Price Prediction

Attachments
130.zip (1.93 KB, Download 0 times)

If you're diving into the world of trading, you might have heard of Fourier extrapolation as a powerful tool for price prediction. But what does it really mean? Let's break it down in simple terms.

Understanding the Multi-Harmonic Model

At its core, this method uses a multi-harmonic trigonometric model to analyze a price series, represented as x[i] for i from 1 to n. The formula looks like this:

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

Here's what each term in the equation represents:

  • x[i] - This is the past price at the i-th bar, with a total of n past prices.
  • m - This is the bias or baseline price.
  • a[h] and b[h] - These are the scaling coefficients for the harmonics.
  • w[h] - This indicates the frequency of a harmonic.
  • h - This is the harmonic number.
  • H - This denotes the total number of fitted harmonics.

Fitting the Model

To fit this model, you need to find values for m, a[h], b[h], and w[h] that closely match the actual market prices. The trickiest part is identifying the harmonic frequencies w[h]. For a Fourier series, these frequencies are typically set at 2πh/n. However, it's essential to note that Fourier extrapolation essentially repeats the n past prices into the future.

This particular indicator leverages the Quinn-Fernandes algorithm to accurately determine harmonic frequencies. It fits each harmonic of the trigonometric series one at a time until it reaches the desired number of harmonics, H. After fitting a new harmonic, the algorithm calculates the residue between the updated model and the actual values, then fits another harmonic to this residue.

Indicator Inputs

Here are the key input parameters for the indicator:

  • Npast - This is the number of past bars used for fitting the trigonometric series.
  • Nfut - This indicates the number of future bars to be predicted.
  • Nharm - This is the total number of harmonics included in the model.
  • FreqTOL - This is the tolerance level for frequency calculations.

How It Works

Once set up, the indicator plots two distinct curves on your chart: a blue curve that shows the modeled past values and a red curve that represents the projected future values. This visual representation can help you make more informed trading decisions.

Fourier extrapolation of price

Related Posts

Comments (0)