Search This Blog

Wednesday

Fourier Extrapolation of Indicator.mq4


This forex indicator is a modification of the indicator Extrapolator, which uses only the first method of extrapolation (Fourier) and adding the possibility of using the values of the selected indicators as input data.Фурье ряд. Attached indicator uses spectral analysis of the selected indicator, and extrapolates these values into the future using the Fourier series. For example, the indicator is selected Williams Percent Range. Vector in [] the values of the selected indicator. The graph at the bottom, black line in the window FEoI - value indicator, Blue Line - the Fourier series for the past values, the red line - extrapolation of Fourier series in the future. Predicted values begin with LastBar-1 and include the last known bar in the history of LastBar for continuous docking of modeled past (Blue Line) and future (red line) values.

Forex Indicators

Input data:

extern int LastBar = 200, / / Number of the last bar of history. 0 is the last on the schedule.
extern int PastBars = 500, / / Number of bars in history, which made the spectral analysis and fitting of Fourier series
extern int FutBars = 200 / / Number of bars in the prediction
HarmNo=PastBars extern int HarmNo = 10 / / Number of members in the Fourier number; HarmNo = 0 selects the maximum number of harmonic components HarmNo = PastBars
extern double FreqTOL = 0.0001; / / The accuracy of calculations of frequencies by the method of Quinn-Fernández

The line where the change is indicated at the bottom of the selected indicator red

int start() int start ()
{ (
ArrayInitialize(in,EMPTY_VALUE); ArrayInitialize (in, EMPTY_VALUE);
ArrayInitialize(pv,EMPTY_VALUE); ArrayInitialize (pv, EMPTY_VALUE);
ArrayInitialize(fv,EMPTY_VALUE); ArrayInitialize (fv, EMPTY_VALUE);

//Choose indicator and find the average of its np past values / / Choose indicator and find the average of its np past values
double x[]; //stores indicator values double x []; / / stores indicator values
ArrayResize(x,np); ArrayResize (x, np);
double av=0.0; double av = 0.0;
for(int i=-lb;i<> for (int i =- lb; i
{ (
in[i+lb]=0.5+iWPR(NULL,0,50,i+lb)/100.0; //change indicator here in [i + lb] = 0.5 + iWPR (NULL, 0,50, i + lb) / 100.0; / / change indicator here
if(i>=0) if (i> = 0)
{ (
x[i]=in[i+lb]; x [i] = in [i + lb];
av+=x[i]; av + = x [i];
} )
} )
av/=np; av / = np;

//Prepare modeled data / / Prepare modeled data
for(i=0;i<> for (i = 0; i
{ (
pv[i]=av; pv [i] = av;
if(i<=nf) fv[i]=av; if (i <= nf) fv [i] = av;
}< /p> <>//Fit trigomometric series )

/ / Fit trigomometric series
double w,m,c,s; double w, m, c, s;
for(int harm=1;harm<=HarmNo;harm++) for (int harm = 1; harm <= HarmNo; harm + +)
{ (
Freq(x,w,m,c,s); Freq (x, w, m, c, s);
for(i=0;i<> for (i = 0; i
{ (
pv[i]+=m+c*MathCos(w*i)+s*MathSin(w*i); pv [i] + = m + c * MathCos (w * i) + s * MathSin (w * i);
if(i<=nf) fv[i]+=m+c*MathCos(w*i)-s*MathSin(w*i); if (i <= nf) fv [i] + = m + c * MathCos (w * i)-s * MathSin (w * i);
} )
} )

//Reorder the predicted vector / / Reorder the predicted vector
for(i=0;i<=(nf-1)/2;i++) for (i = 0; i <= (nf-1) / 2; i + +)
{ (
double tmp=fv[i]; double tmp = fv [i];
fv[i]=fv[nf-i]; fv [i] = fv [nf-i];
fv[nf-i]=tmp; fv [nf-i] = tmp;
} )
return(0); return (0);
} )


Download forex - LED Fourier Extrapolation of Indicator.mq4

2 comments:

Julio Bento said...

I can´t down this indicator
Regars
Julio

Unknown said...

Sorry!!! Problems with Blogspot :(
http://codebase.mql4.com/download/14919