Hearst index - page 18

 
surfer >> :

I just made a mistake in one place in the indicator.

The weighting factor doesn't give anything, it's a difference of a thousandths.

Well, the fact that it bounces, yeah.

Have you tried the second function?

Pictures would be nice to see... not of the indicator but of the resultant line itself.

 
TheXpert >> :

Have you tried the second function?

I'd like to see some pictures... Not of the indicator but of the resultant line.

I haven't tried the second one.

I'm not sure what pictures you want to see.

i'm giving you the indicator, maybe it will show the pics :)


Files:
ivar_2.mq4  5 kb
 
Prival >>:

Ерунда какая то с этим херстом. Добиться 0.5 не получилось (хотя давал на вход rnd()). Единицы тоже не получилось добиться, хотя подавал x(i)=i (ряд все время растет)

Файл прилагаю, версия маткада 14

Everything works if you take n not from 1 to 10...but at least up to 3000

Your second version of the calculation is also correct - again, feed more data...

 
tenyps писал(а) >>

Everything works if you take n not from 1 to 10...but at least up to 3000

Your second version of the calculation is also correct - again, feed more data...

What next? Pinned, no connection to quotient or am I missing something?

 

Good afternoon) I have read partially all the pages, but unfortunately I don't understand all the algorithms. A similar question has already flown here. As far as I understood the MQL4 and C syntax is more or less the same, but the structures are different, and there are more "libraries" with different statistical functions.

I have written the algorithm in C, so here is a bit of code:


double Herst( double *S, int n)

{

double *h1 = (double *) malloc(sizeof(double ) * n),

*h2 = (double *) malloc(sizeof(double ) * n),

*h = (double *) malloc(sizeof(double ) * n),

*Hn = (double *) malloc(sizeof(double ) * n),

h_ = 0, Rn = 0, Sn = 0, RSn = 0;

h[0] = 0, h[1] = 0, Hn[0] = 0, Hn[1] = 0;

if( h == NULL || Hn == NULL || h1 == NULL || h2 == NULL )

{

printf("Not enough memory!!!\n");

return -1;

}

for( int i = 1; i < n ; i++ ) h[i-1] = log( S[i] / S[i-1] );

for(int i = 1; i < n; i++ ) Hn[i] = Hn[i-1] + h[i-1];

if( (n - 1) != 0) h_ = Hn[n - 1] / ( n - 1 );

h2[0] = (h[0] - h_) * (h[0] - h_)

h1[0] = (h[0] - h_);

for( int i = 1; i < n - 1; i++ )

{

h1[i] = h1[i-1] + (h[i] - h_);

h2[i] = h2[i-1] + (h[i] - h_) * (h[i] - h_);

}

qsort( (double *)h1, n-1, sizeof(T), Comp );

Rn = h1[n - 2] - h1[0];

if( (n - 1) != 0 ) Sn = h2[n-2] / ( n - 1 );

if( (n - 1) == 0 ) Sn = h2[n-2];

RSn = Rn / Sn;

free(h);

free(hn);

free(h1);

free(h2);

return RSn;

}


Then the arrays are shoved into the arrays:

for( int i = n_min; i < n; i++ )

{

x1[i - n_min] = log( double( i * 0.5) )

y1[i - n_min] = log( Herst( S1, i );

}

and a straight line is drawn using ANC.

Question - I occasionally encounter a value higher than 1, but very rarely. I cannot understand what the error is. I checked ANC on simple lines ( y=ax+b, for a={0,0.5,1,2,3} and b = {-1,0,1,2} )

What if for the first 3-5 sample values the standard deviation is 0? So RS equals infinity and just don't consider these points?

Oh, and the main thing - am I right in standing the sequence of points (in the beginning for n_min, then for the same n_min + the next value, etc.) or should I divide the segment of n into some equal parts and count for each?

I tried to figure it out myself, but two weeks later I gave up. The algorithm was based on the following books - "Fractal Analysis of Financial Markets" by Peters and "The Fundamentals of Financial Mathematics" by Shiryaev.

 
Disa >>:

День добрый) Прочитал частично все страницы, но к сожалению не все алгоритмы понял.


Pardon me for not answering the question, but it may come in handy.
With a test case, though.
Strictly according to Peters "Fractal Analysis of Financial Markets".

Files:
 
Vita >>:

Пардон, что не по вопросу ответ, но возможно пригодится.
С тестовым примером зато.

The test file itself. H~0.72

Files:
brown72.txt  10 kb
 
I did a long conversion to speed up the calculation,
and ended up with this simplified formula for the Hurst exponent:
for(i=limit;i>=0;i--)
    {double LWma=iMA(NULL,0,period,0,MODE_LWMA,PRICE_CLOSE,i);
     double Sma=iMA(NULL,0,period,0,MODE_SMA ,PRICE_CLOSE,i);     
     double Bma=iBands(NULL,0,period,1,0,PRICE_CLOSE,MODE_PLUSDI,i);
     if(Bma!=Sma) e0[i]=(LWma - Sma)/(Bma-Sma);           
    } 
It seems to be logically correct,
though without logarithms.
 
Urain >>:
Долго преобразовывал чтоб ускорить расчёт,
в результате получил вот такую упрощённую формулу для показателя Херста :
логически вроде бы всё верно,
хотя без логарифмов.

This is not a simplified formula for the Hearst index. You are mistaken.
There are many ways to calculate the Hearst figure and they are all labour intensive. Which one did you simplify?
And your formula may be less than zero, which is not helpful at all.

 
Vita >>:

Это не упрощенная формула для показателя Херста. Вы заблуждаетесь.
Способов расчета показателя Херста много и все они трудоемки. Вы какую упрощали?
И ваша формула по ходу может быть меньше нуля, что совсем не кстати.

It's not about the absolute numbers, it's about the idea.

The formula shows the ratio of the regression rate (angle) to the standard deviation, which I think is in the spirit of Hirst.