Random Flow Theory and FOREX - page 6

 

dreder, thanks for the advice, but I'm not likely to take it: I'm an addict, and one real dose was enough to get me hooked. And you're an addict too, aren't you?

In fact, why not join a small circle of junkies, some of whom know a lot about maths (not me)?

2 Candid: I'll get it together and send it over. There's Marple, Sato, Wald, Farina, lectures on DSP and calculating ACF in Mathcad. I hope the whole archive will go through at once (I have about 13.5 Mbytes all together, so it will be less than 20 when forwarding). I sent it to you from another mailbox. Drop me a line with the result - or email me.

 
Prival:

Let me try to explain the ACF with an example, ...

Well, I knew the definition of ACF in principle, it's just that there are often as many people as there are formulas :). If you don't calculate it outright, of course.
And what's wrong with fastcorellation from klot's library?
 
Mathemat:

In fact, why not have a little chat in a small circle...

I'm all for it, except that I'm not good at maths, I'm a C at best. Vod a couple of drinks in this rich experience of aviation radio engineer :-)

lna01 about the fastcorellation, I didn't know it was there, sorry if I bothered you again :-), how it all counts.

 
Prival:

lna01 about fastcorellation I didn't know it was there, sorry if I start asking bad questions again :-), how it all counts.

Read more about it here - http://alglib.sources.ru/fft/fastcorrelation.php
The format is as follows:
void fastcorellation(double& signal[], int signallen, double pattern[], int patternlen)
/*************************************************************************
Corellation using FFT

On input:
Signal is an array of signal, with which we perform the correlation.
Numbering of elements from 0 to SignalLen-1
SignalLen - signal length.

Pattern - array of patterns, the correlation of the signal with which we are looking for
Numbering of elements from 0 to PatternLen-1
PatternLen - the length of the pattern.

Output:
Signal - correlation values at points from 0 to
SignalLen-1.
*************************************************************************/
 
Yeah, it all makes sense. Judging by the description, the arrays are actually periodic, and for such data the ACF will by definition depend on the difference of the arguments, i.e. the process will automatically become stationary. Doesn't fit, damn it...
 
Mathemat:
Yeah, I get it. Judging by the description, the arrays are actually periodic, and ACF for such data will depend on the difference of arguments by definition, i.e. the process will automatically become stationary. Doesn't fit, damn it...

The ACF will be symmetrical if you use the FFT, i.e. you need the data up to the middle. Although I don't know where you want to apply it.

If the ACF depends on the difference in the arguments, it's non-stationary.

 
Mathemat:
Yeah, it all makes sense. Judging by the description, arrays are actually periodic, and for such data ACF will by definition depend on the difference of arguments, i.e. the process will automatically become stationary. Doesn't fit, damn it...
They are periodic, of course, but with a period of the first 2^n bigger, exactly up to this length zeros are added - it follows from the source. So they are actually non-periodic :)
 
I need a procedure that calculates coefficients a and b in equation y(x)=a*x+b. Then I may be able to build some curve ACF algorithm in MQL again
 
Prival:
I need a procedure that calculates coefficients a and b in equation y(x)=a*x+b. Then maybe I will be able to create some curve ACF algorithm in MQL again.
Probably, it's difficult to find someone who hasn't made such a function for himself. So have I :) Functions'.
 
Prival:

I will try to explain ACF by example, let's say we have two data sets, the first 0 1 2 3 4 5 and the second 10 11 12 13 14 15, if we calculate the correlation coefficient (CC) of these arrays it = 1, ie knowing the 1 set we can accurately calculate the second, if the second set would be 15 14 13 12 11 10, the CC would be = -1, ie when one set increases, the second in the same proportion decreases.

The ACF (autocorrelation function, is a comparison of the array to itself only shifted in time. At shift=0, ACF =1, as the original data exactly matches itself. When we increase the shift, ACF starts to change, dangling between -1 and 1, zero means no correlation.

If the ACF of the quote stream was all the time =1 eh what a grail it would be :-).

I got the pictures, I posted them above. But they are just for 1 sample, I think ACF should vary over time (it certainly does for the grail would have been found long ago), but if we find the function approximating it and only if we find parameters of this function it will be a significant step forward

What ACF analysis gives us

1. to construct a more or less adequate model of time series.

2. to determine the time during which the process is correlated, i.e. the time when we can predict the curve behavior

3. ACF can be used in various ways, up to making trade decisions. The main thing is to understand it and understand its behavior at various time intervals


I tried to write a script in MQL that displays correlogram (autocorrelation function) of time series in a separate window. The code builds a series of first differences and finds a sample average of Nbars values, the correlation coefficient for the current difference Open[i]-Open[i+1] with itself (column with a zero index), with the previous differenceOpen[i+1]-Open[i+2] (column with index number 1),..., with the k-th difference Open[i+k]-Open[i+k+1] (column with index number k), etc.., k runs values from 0 to n.

//+------------------------------------------------------------------+
//| FAK. mq4 |
//| Copyright © 2007, Neutron |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_width1 4

extern int Nbars=10000, n=100;
int i,step,start;
double s1,s2,fak[1000],Dif[10000];

int start()
{
Start=Nbars+n;
for (i=Start;i>=0;i--){Dif[i]=Open[i]-Open[i+1];}

for (step=0;step<=n;step++){s1=0;s2=0;
for (i=Nbars;i>=0;i--){s1=s1+Dif[i]*Dif[i+step];s2=s2+Dif[i]*Dif[i];}
fak[step]=s1/s2;}
}

int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,fak);
return(0);
}

Pay attention that on the minutes EUR/GBP pair shows a strong negative correlation between the adjacent readings (the bar with the index 1 and the value -0.25). To avoid showing of an incompletely informative zero column (always identically equal to 1), it is necessary to draw a line:

for (step=0;step<=n;step++){s1=0;s2=0;

replace with:

for (step=1;step<=n;step++){s1=0;s2=0;

The product of the autocorrelation coefficient r1 by the instrument volatility on the selected TF will give the average profitability of the TS based on the Markov process. Unfortunately, this value does not exceed the DC commission.