Calculation of the slope angle of the trend line. - page 24

 
Dmitry Fedoseev:

What do you mean by "decisions"? From Cambridge, by authoritative authorship?

There are 1000s of these solutions. You just have to sit and try until you see a satisfactory result.

The algorithms of brute force. Rather than searching for it, it's easier to try it out on simple problems...

 
Dmitry Fedoseev:

Can you explain in your own words what CUSUM is and how it is implemented?

===


===

The method is of course a masterpiece, and how deeply thought-out! What the hell - Cambridge! Are you guys all incapable of using your own brains, even formulas in arithmetic only with reference to an authoritative publication?

===

Alexei, and if the raw data can take negative values? That's it, a mathematical disaster?

I imagine the method roughly as follows. Suppose before the disambiguation, the average value of the summed series Xn is A, and e is a small positive number. Then the series Xn-A+e will give a weak upward trend when summed, andXn-A-e will give a weakdownward trend when summed.If the average of the series is B and |A-B|>e, there will be a reversal of the trend of one of the two series we have constructed. Since we are interested in accumulating the sum of each series with a certain sign (up to a given threshold value), we simply zero out the accumulation with the opposite sign at each step.

 
Valeriy Yastremskiy:
From Wiki: When the value of S exceeds a certain threshold value, a change in value has been detected. The above formula detects changes only in the positive direction. When negative changes are to be found, as well, the min operation should be used instead of the maximum operation, and this time the change has been detected when the S value is below the (negative) threshold value.

That was the first thing that came into my head)))

I'll probably have to do some checks. For velocity difference over the whole range, and if more than calculated corridor width by first sliding window and then sliding window of 3 - 5 values go to look at average, nominal and if several windows in sequence, then corridor, if window parameters in next step go off-scale, then no corridor.

CUSUM is a parametric test (implies normality of series). A nonparametric test can be done on the basis of the Mann-Whitney test (available from the Alglib). For every instant of time n, we take all series into two waveforms from 1 to k and from k+1 to n and perform the Mann-Whitney test on them. If the two such chunks turn out to be unequally distributed, then moment k+1 can be considered as the moment of decomposition.

 

Calculate the average from the difference on two neighbouring bars. A positive average means an upward slope, a negative average means a downward slope. Using the average filters out short-term minor changes of direction. You can also add threshold crossing (for an introduction to higher mathematics, so to say).

You can calculate two averages, one slightly faster and one slightly slower - their position will determine the slope of the average.

 
Aleksey Nikolayev:

CUSUM is a parametric test (assuming normality of the series). A non-parametric test can be based on Mann-Whitney test (available on Alglib). For each moment of time n, we take all series into two chunks from 1 to k and from k+1 to n and count Mann-Whitney on them. If the two such chunks turn out to be unequally distributed, then moment k+1 can be regarded as the moment of decomposition.

Alternatively, one can just start using one's own brains.

 
Dmitry Fedoseev:

You can also just start using your own brain.

Well, yes, a fatal flaw)

 
Aleksey Nikolayev:

Well yes, a fatal flaw)

And even here there are no words of their own, but a reference to something sort of authoritative. But off-topic. It's an elementary problem to solve here and elementary means are sufficient to solve it.

But to roll out an authority for every shenanigan... This is a bummer. Crisis of the mind.

 
Aleksey Nikolayev:

CUSUM is a parametric test (assuming normality of the series). A non-parametric test can be based on Mann-Whitney test (available on Alglib). For each moment of time n, we take all series into two chunks from 1 to k and from k+1 to n and count Mann-Whitney on them. If the two such chunks turn out to be unequally distributed, then moment k+1 can be considered as the moment of decomposition.

Exactly, two windows , we determine the inflection point. Norm. Thanks)
 
Dmitry Fedoseev:

Calculate the average from the difference on two neighbouring bars. A positive average means an upward slope, a negative average means a downward slope. Using the average filters out short-term minor changes of direction. You can also add threshold crossing (for an introduction to higher mathematics, so to say).

You can calculate two averages, one slightly faster and one slightly slower - their position will determine the slope of the average.

I did not get the idea. That was the problem. The inflection point would go into the calculation of the average and the result would lag. The right and left should be averaged.
 
Valeriy Yastremskiy:
I didn't get the idea. That was the problem. The inflection point went into the calculation of the average and the result lagged. On the right and on the left you have to average.

What is there to understand? If the line is directed upwards, its difference with its previous value is positive, if it is directed downwards, the difference is negative (and the greater the difference in modulo, the steeper the direction). This direction indicator is averaged to miss some false short-term changes of direction. Naturally, if averaging is used, there will be a lag. There will be a lag in any case if you exclude something.

You can do something like NRTR instead of averaging. For example, when the line is directed upwards, we fix the maximum, the pullback from the maximum to the threshold will be a change of direction. This threshold may be constant, it may be proportional to std. But in this case there will also be a lag. There will always be a lag. The smaller the errors in determining the change of direction, the larger the lag, the smaller the lag, the larger the errors.

And you know, solving such problems doesn't cost an egg, they are solved in between on the fly. What's going on with you guys here? Soon you won't be able to do arithmetic without an authoritative formula.