Machine learning in trading: theory, models, practice and algo-trading - page 2064

 
Aleksey Nikolayev:

We look for Di - the average square of the increments for the i-th minute of the day. Then divide all increments by their corresponding di=sqrt(Di). We sum up the squared increments and look for deviations from the SB in the new series. The price is distorted, but the time does not change.

What is the point of having 2 months for every minute? The changes at each minute will be small, and the calculations will be large. And the minutes back or a month back and a month forward. Code for the first bar.

for(int i = 1,i<= 43200*2, i++);
{
Di+=pow((iClose(NULL,1,i) - iOpen(NULL,1,i)),2)/i ;
}
di=sqrt(Di);

New row.

for(int i = 1,i<= 43200*2, i++);
{
NewClose[i]=iClose(NULL,1,i)/di;
NewOpen[i]=iOpen(NULL,1,i)/di ;
}

Is it correct?

 
Valeriy Yastremskiy:

Is this correct?


I guess not.

I understood the algorithm this way: let's assume the time is 10:00, count Di for bars m1 of this time and then for 10:00 minutes (close[i] - open[i])/di and so for every minute.

 
Evgeniy Chumakov:


I don't think so.

I understood the algorithm this way: let's say the time is 10:00, count Di for bars m1 of this time. And then for 10:00 minutes (close[i] - open[i])/di and so on for every minute.

Code for the first bar. You have to move it deeper, it's one more loop from above.
 
Evgeniy Chumakov:


I don't think so.

I understood the algorithm this way: let's say the time is 10:00, count Di for bars m1 of this time, and then for 10:00 minutes (close[i] - open[i])/di and so on for every minute.

Yes, that is correct. We have two archives - real and integer, size 1440=24*60. In the first one, sum the squares of increments, and in the second - the number of bars for the given minute, and then divide the first by the second (for numbers with number of bars greater than 1). Then we extract the root and only after that we renormalize the increments and collect the cumulative sum from them - a new series, which we already investigate if it differs from SB.

 
Aleksey Nikolayev:

Yes, that's right. We have two archives - real and integer, size 1440=24*60. In the first one, sum up the squares of increments, and in the second - the number of bars for a given minute, and then divide the first by the second (for numbers with more than 1 bar). Then we extract the root and only then we renormalize the increments and collect the cumulative sum from them - a new series, which we already examine for the difference from the SB.

I.e. the square average of the minutes for 24 hours, and so for 2 months of minutes. Minute bar number? The sum of squares divided by 1440?

 
Valeriy Yastremskiy:

The sum of squares divided by 1440?


You divide the sum of squares by the number of bars for a particular minute and then extract the root.

 
Aleksey Nikolayev:

Yes, that's right. We have two archives - real and integer with size 1440=24*60.


I.e. you need to build a cumulative sum for a day = 1440 minutes?

 
Evgeniy Chumakov:


You divide the sum of the squares by the number of bars for a particular minute, and then extract the root.

Then I don't understand. For the depth of bar 3, the number will be three, and this value is calculated for the 3rd bar or for the first. I understand that the average would be calculated for the same number of bars, not cumulative total. It would be better to give the formula right away. We all understand words differently.)

for(int i = 1,i<= 1440, i++);
{
Di+=pow((iClose(NULL,1,i) - iOpen(NULL,1,i)),2)/i ;
di=sqrt(Di);
DVal[i]=(iClose(NULL,1,i) - iOpen(NULL,1,i)/di; 
}

If you ask me, it is not right.

 
Valeriy Yastremskiy:


Doesn't sound right to me.


the code is not correct

 

Assuming that there are no gaps in the history and there are 1440 minutes in all days (less on Friday), the code should be like this:

double di = 0;

int n = 40; // глубина 40 суток (два месяца)

int pos = 0; // текущий бар

int step = 0; // шаг


for(int i = 0; i < n; i++){

di += MathPow( close[pos + step] - open[pos + step],2);

step += 1440;
}

di = MathSqrt(di/n);

double x = (close[pos] - open[pos])/di;
Reason: