From theory to practice - page 376

 
Alexander_K2:

Here we are primarily interested in the variance and therefore the standard deviation. Let us rewrite it:

sigma = CORNER(c*lambda*t), where:

c is some constant

lambda - the average value of the increments

t - time.

This formula is the Alpha and Omega, the Yin and Yang of Forex. The Grail, to put it simply.

Let's deal with it in more detail, pointing out the error that I've made.

Looking at your formula, Eskander, I remember how I danced on this rake in 2006 (even before I became acquainted with this forum).

It makes me long for it.

 

Immediately we get into conceptual stuff, where not only mathematical calculations are required, but also an appropriate level of abstract thinking, philosophy, if you like.

1. TIME t.

Time... A philosophical character! The stumbling block of thinkers and philosophers. A gift from fate or the unknown, an abyss into which we are not meant to look? No answer... But we do need one! Let us try to understand.

Why do we not calculate the variance continuously from the start of Forex until its logical death?

The answer is obvious. Even the great physicist Einstein and trader Gunn noticed that the variance of a process is proportional to the root of t.

Honestly, I don't know what Gann's measure of time was, but with Einstein it was seconds.

So if you follow the standard deviation all the time, it grows with time and . And it's no big deal. No earnings, no Nobel Prize... Nothing.

So, we are forced to consider the process in a strictly defined time window of observation, hoping that a certain probability density function with an appropriate standard deviation takes place in that window.

 
Nikolay Demko:

Looking at your formula Escander, I remember dancing on that rake in 2006 (before I knew the forum).

It makes me long for it.

:))) It's a good thing.

 
 

Now watch the trick with time.

Reminder:

sigma = Root(c*lambda*t), where:

c is some constant

lambda - the average of the increments

t - time.

Let's choose sliding time window of observation t=14400 sec. (4 hours. Why 4 hours? That is a topic for a separate discussion).

 

2. The mean value of lambda increments.

All physical processes similar to the Brownian motion are always considered under the assumption of a random character of particle collisions, with deltaT -->0 between collisions.

However, in our case this assumption is incorrect. The character of changes in the number of quotes in the sliding observation window =4 hours has a cyclic nature depending on the time of the day and is different for different currency pairs.

Thus, if we consider lambda to be a time average, it will give the same wrong data for a currency pair with huge but infrequent jumps and for a pair with frequent small jumps.

It is correct to take lambda as an average of the number of quotations received in time t.

Let's rewrite the formula for the standard deviation:

sigma = Root(c*(SUM(ABS(return))/N)*t), where:

c is some constant

return - the value of increment at a given moment of time

N - the number of quotes for the time t

t - time.

 
Nikolay Demko:

Great video, just watched it yesterday, I've been sitting here for an hour thinking about how I could add a Pythagoras triangle as money management to some kind of order grid

 

For now, we do not consider the constant c. It is very important and we will come back to it.

Now I'm just going to point out the unpleasant thing that hit me in the face. And it hurt like hell...

I used to work with uniform time t=1 sec. I considered exponential intervals theoretically as a possibility to work with Erlang flows.

In window=4 hrs had:

sigma = Root(c*(SUM(ABS(return))/N)*14400).

But the problem was not yet solved. The constant c! That's the one which is not so easy to calculate. I know how to do it, but to do it we need to enter the space where all currency pairs in 4 hours have the same amount of quotes for time t. I.e. get into the right Erlang flow.

For the time being, I simply put c=0.01 for JPY pairs and c=0.0001 for all others.

I.e. I used the formula:

sigma = Root(0.01*(SUM(ABS(return))/N)*14400) for pairs with JPY.

sigma = Root(0.0001*(SUM(ABS(return))/N)*14400) for all others.

Now I think that's it - it's time for the Erlang flows.

I have chosen a 2nd-order thread. I.e. average quote reading time = 2 seconds. I get:

sigma = Root(0.01*(SUM(ABS(return))/N)*7200) for JPY pairs.

sigma = Root(0.0001*(SUM(ABS(return))/N)*7200) for all others.

И... Got it in the ass...

 

What to do? Give up Erlang's streams? Go back?

No!

The path to the Grail will continue.

But, for now, I need help.

I ask respected mathematicians-programmers to suggest an HF generator with Erlang distribution which would outputinteger numbers, but whose average value would strictly follow the order of the stream

I think it should be a discrete Pascal distribution generator (see negative binomial distributionhttps://habr.com/post/265321), but not sure...

The problem is this.

If I use the NF generator fromhttps://en.wikipedia.org/wiki/Erlang_distribution(seeGenerating Erlang-distributed random variates), then the numbers in the real format for a 5th-order thread with lambda=1 really have arithmetic mean, mode and median = 5. But in Integer format moda and median = 5, but the arithmetic mean = 5.5. I need everything to be strictly = 5 in Integer format as well, because we are working with discrete time.

Thank you in advance.

Генераторы дискретно распределенных случайных величин
Генераторы дискретно распределенных случайных величин
  • 2016.01.16
  • habr.com
Данная статья является продолжением поста Генераторы непрерывно распределенных случайных величин. В этой главе учитывается, что все теоремы из предыдущей статьи уже доказаны и генераторы, указанные в ней, уже реализованы. Как и ранее, у нас имеется некий базовый генератор натуральных чисел от 0 до RAND_MAX: С дискретными величинами все...
 
Alexander_K2:

What to do? Give up Erlang's streams? Go back?

No!

The path to the Grail will continue.

But, for now, I need help.

I ask respected mathematicians-programmers to suggest an HF generator with Erlang distribution which would outputinteger numbers, but whose average value would strictly follow the order of the stream

I think it should be a discrete Pascal distribution generator (see negative binomial distributionhttps://habr.com/post/265321), but not sure...

The problem is this.

If I use the NF generator fromhttps://en.wikipedia.org/wiki/Erlang_distribution(seeGenerating Erlang-distributed random variates), then the numbers in the real format for a 5th-order thread with lambda=1 really have arithmetic mean, mode and median = 5. But in Integer format moda and median = 5, but the arithmetic mean = 5.5. I need everything to be strictly = 5 in Integer format as well, because we are working with discrete time.

Thanks in advance.

Collect statistics on the number of numbers generated by the computer's GSF. Every time you will have the same result if the number of generations is large enough.

So use a cotier

Reason: