a trading strategy based on Elliott Wave Theory - page 282

 
To Neutron

It is clear that FZ decreases as the sample window gets narrower but the smoothing properties of the operator get worse. We have to find a compromise between smoothing quality and lag. That is why it is correct to compare smoothing characteristics of operators with equal or close parameters of their frequency response (evenness in passband, cut-off slope). In this regard, Butterworth filter has minimum (not zero!) bandwidth, which significantly increases at cut-off frequency. It is in this light that it is interesting to compare wavelet-based and classical filtering methods.


Here I agree with you. About the comparison... For wavelets, it's not easy to calculate directly the characteristics you're talking about (AFC, FS, etc). I don't want to dig deep into theory for that at the moment. I am, however, planning some experiments with specific price series. If I get a meaningful result, I'll share it with you. But it takes time...

If we are going to extrapolate something somewhere, there will inevitably be an FZ. Indeed, sitting at the right end of the time series and extrapolating one step forward, we obtain the probable value of the series in question. In the next countdown, compare the value with the true value and remember the resulting error. Repeat this procedure once more, taking into account the update of the input data for the second point, and so on and so forth. As a result we have two time series - initial and forecast. Obviously, they do not coincide exactly, but also do not diverge strongly, only shifted relative to each other by FZ! So I think the term FZ is appropriate for this case.


In principle I agree too. It's just that different fields have their own terminology, a basic set of terms and these sets often don't overlap.

Another nuance about forecasting. We can extrapolate the original price series, so to speak, as a whole - for example, by approximating it with a polynomial and continuing this polynomial into the future (this is the example you give below).
But there is another approach. We can first decompose our series into simpler components. There are a lot of reversible transforms without loss of information - Fourier, wavelets and many others. Then we extrapolate for each component. And since these parts are simpler than the whole, the extrapolation will be easier or at least more convenient and efficient. And maybe it will be better. The result is rolled back, thereby obtaining extrapolation for the series as a whole.
Of course these two approaches are equivalent in their essence, but I like the second one better. Perhaps I am not the only one. I've often come across discussions of price prediction using Fourier harmonics on the net. Although what I've seen was rather clumsy. Correspondingly, so were the results.


Now, colleagues, critique me.
I argue that any extrapolation implies that a time series (TP) has the property of "following" the chosen direction. Indeed, by extrapolating one step ahead by a polynomial of nth degree, we assume the NEED for the first derivative, the second... n-1 of the original series, at least at this step... Do you see where I'm going with this? Quasi-continuity of the first derivative is nothing but a positive autocorrelation coefficient (AC) of BP at the selected timeframe (TF). It is known to be pointless to apply extrapolation to Brownian-type BPs. Why? Because the CA of such series is identically equal to zero! But, there are GRs with negative QA... It is simply incorrect to extrapolate to them (if I'm correct) - the price is likely to go in the opposite direction from the predicted direction.
And for starters: Almost all Forex VRs have a negative autocorrelation function (this is a function constructed from the KA for all possible TFs) - this is a medical fact! The exceptions are some currency instruments on small timeframes, and yes Sberbank and EU RAO stocks on weekly TFs. This, in particular, explains the unsuitability in the modern market of the TS based on the exploitation of moving averages - the same attempt to extrapolate.
If I am not mistaken, wavelets, a priori, find themselves in an area where they will not be able to perform their functions correctly.


If I remember your previous posts correctly, you first of all differentiate the price series in order to calculate the autocorrelation function. Thus, mind you, you throw out a good portion of the low- and medium-frequency harmonics of the series! For statistics, of course, this approach is sensible. But aren't we throwing the baby out with the water here?
There are many interesting things in low frequencies. For example, trend movements.
On an empirical level, everyone agrees that market patterns repeat themselves. Indeed, it's easy to find trend channels or other figures on the history of any financial instrument, which look like twin brothers, but they are separated by very significant time intervals (sometimes years). This is a fact. I hope you are not going to argue with that?
And the characteristics (eigenfrequencies of a trend channel, average lifetime, etc.) are not the same. - I am not going to disseminate now how I define them) of these "phenomena" often practically coincide (on comparable scales - there is no sense in comparing minutes and days), and they do not change in time by leaps and bounds, but always drift smoothly. I can clearly prove this fact using wavelet methods. So far using single examples, but I'm going to gather representative statistics on the history soon.

What could this mean? A direct informational connection is unlikely, market long term memory is doubtful, the manifestation of some internal market structure, its deep properties that we know nothing about, is possible. It seems as if there is a whole series of sets of the market's own frequencies, which it goes through smoothly and quietly over time.
Why are so many trend channels so similar? Why are their properties so stable? Why do similar structures appear at different nesting levels and are their frequency layouts not entirely random? Referring simply to fractality is not very constructive. And more importantly, can't it be used for trading?

Not at all trying to belittle the statistical approach here. You once calculated a forecast horizon based on AK. The wonderful thing is that it exists. Let's use that fact in the right circumstances!
But it seems to me that there is more to the market than statistical properties alone. If we can see and catch the, shall we say, "dynamic" properties of the market, it will give us an additional advantage. I hope you don't mind?

Regards.
Good luck and good trends!
 
<br/ translate="no"> There are many interesting things lying in the low frequencies. For example, trending movements.


By the way, the idea is probably silly, but nevertheless. For example, we define for an instrument a frequency range (possibly floating) which will further symbolize low frequencies. With a fixed sliding window we go through the series and for each sample plot (within the low frequencies):

- or some total factor, for example, the sum of amplitudes,
- or total energy of low frequencies
- or consider each amplitude of corresponding low frequencies segment
- (there can be variants).

Further, we predict future values for these quantities, using some methods (the simplest, linear regression or parabolic, there may be more complex methods, crawler, neural networks, etc. is not important yet).

By getting the predicted harmonic values on future samples, we "somehow" reconstruct the signal, i.e. from the predicted low frequency, we reconstruct the low frequency signal, a kind of future "trend".

I haven't got my hand to it yet. Colleagues, what do you think, I understand that the amplitudes will also be random values, but still?
 
Andre69
But there is another approach. We can first decompose our series into simpler components. There are plenty of reversible transformations without loss of information - Fourier, wavelets and lots of others. Then we extrapolate for each component.

grasn
Next, we predict future values for these values, using some methods (the simplest, linear regression or parabolic, there may be more complex ways, crawler, neural networks, etc. is not important yet).


Hmmm, isn't this referring to simultaneous relaxation at many frequencies? :) Anyway, ok, I promised not to talk about 1/f :)
About this I started to try, but simple extrapolation did not give anything good - apparently when summing up the errors of extrapolation of individual components do not cancel each other out. Perhaps the point is that I extrapolated too far (by 5 bars or more). But it is also possible that the changes in the amplitudes of the components are not independent. Here, for example, FZ - we can say that the filter sort of does not see high frequencies. But in fact it still reacts to them after some time. So there is a sort of pumping of energy from high frequencies to low frequencies, with a certain finite speed. Should we look for some regularities here? What does theory say about it?
 
Andre69
Но есть и другой подход. Можно сначала разложить наш ряд на более простые компонетры. Обратимых преобразований без потери информации полно - Фурье, вейвлеты и масса других. Затем мы делаем экстраполяцию для каждого компонента.

grasn
Next, predict future values for these quantities, using some method (the simplest, linear regression or parabolic, there may be more complex methods, crawler, neural networks, etc., not important yet).


Hmmm, isn't this referring to simultaneous relaxation at many frequencies? :) Anyway, ok, I promised not to talk about 1/f :)
About this I started to try, but simple extrapolation did not give anything good - apparently, when summing up the errors of extrapolation of individual components do not cancel each other out. Perhaps the point is that I extrapolated too far (by 5 bars or more). But it is also possible that the changes in the amplitudes of the components are not independent. Here, for example, FZ - we can say that the filter sort of does not see high frequencies. But in fact it still reacts to them after some time. So there is a sort of pumping of energy from high frequencies to low frequencies, with a certain finite speed. Should we look for some regularities here? What does theory say about it?



So it's all nonsense and doesn't work. :o(((( I spent half a year searching for the trend (by trend I meant HR of the channel and estimation of its duration) and I didn't find anything good. I tried all known statistics - nothing works. I have only got an empirical function for estimating lengths of these very channels and I am not satisfied with the results.

And it may take my whole life to find regularities in energy transfer between frequencies and find nothing. Although.... :о))))
 
It's just that I used to entertain myself quite a while ago with the following:

- decomposing a price series into impulses (averaging a few per series of 300-500 counts)
- used a neural network to predict a new impulse
- performed convolution of these impulses including the forecasted one

I was not very pleased with the results. So I thought, why not predict low frequencies.
 
I will also add a picture of my Fourier component extrapolation. The further the horizon, the less of the component is involved in the prediction.


In fact it was a trial balloon and not all thoughts were realized. But suddenly an inexplicable skepticism gripped me :), so I didn't start digging further in this place. Although I keep it in my mind.
 
Finally there is a free window of time and I want to continue the post about wavelets.
Sorry for the delay. The hustle and bustle of life is distracting...

Earlier I told you very briefly about DWT. Now about CWT.
To be able to compare them, I'll repeat something else:
1. DWT wavelets should necessarily have a scaling function.
2. DWT gives a complete reconstruction (PR) of the original series in the inverse transformation and not only in theory, but in practice as well.
3. DWT coefficients are exactly the same as the terms of the original series. They are usually stored as a set of vectors of different lengths.
4. The scale changes on each step of transformation exactly twice (dyadic transformation - scale of scales: 1,2,4,8...).
5. Practically DWT coefficients are computed by applying a set of short filters to the original series. Two filters in decomposition and two (others) in reconstruction (Mull's algorithm).
6. ...The rest here and now is irrelevant...

So, gentlemen, continuous conversion - CWT differs from DWT in all the above points!

1. Wavelets for CWT do not have to have a scaling function at all. So, those wavelets that are used in DWT are good enough for CWT, but the converse is not true. What this means in practice. A wavelet function for CWT need not necessarily converge to zero outside a finite interval, it is enough to quickly decay there. That is why there are many very interesting and useful wavelets that can be used here. Among them are Morlet wavelet (very simple and useful thing), Mexican hat, Gaussian wavelet family, etc.
2. CWT gives a complete reconstruction only in theory - in its integral representation. In practice, however, we always operate with a finite set of data and can use a finite set of scales (limited computer memory, computation time, etc.). But this does not mean that the inverse transformation is impossible!
It is quite possible! If everything is done correctly, we will distort only a few first, lowest frequency harmonics (constant component and one or two of the first ones) in the reverse transform. Practice shows that this often does not matter. So, let's move on.
3. CWT is a very redundant conversion. The coefficients can be orders of magnitude larger than the terms of the original series. They are usually arranged in a rectangular matrix. Its width is the time (the number of the source row member), its height is the scale.
And what is a rectangular matrix? Correct. If the data is scaled appropriately, it is an image, a picture.
This is what I personally like most about CWT. As I was quite deeply involved in image processing, including in the sense of pattern recognition, I know how to correctly process such images and look for various features on them. The most charming thing is that I can easily associate these features with the initial series and always tell which place in the initial series the given feature corresponds to. The CWT results for price series show the multivariate nature of the market in all its glory, fractality is revealed once and for all - it can be easily seen, and so on.
4. The scale for CWT can be any. More precisely, it can be any monotonically increasing series of natural numbers. You want linear, you want logarithmic, or other. Whichever is more convenient for the particular problem. And this is good!
5. The practical calculation of CWT is not difficult. The wavelet function is sampled in a suitable way, and the better you want the accuracy of the transform, the more points should be taken. It is then stretched according to the first scale, and convolution with data is done. So to speak - let's try on the suit. We repeat everything until we have exhausted the set of scales. The result is written in the appropriate rows of the preliminarily prepared matrix. The reverse transformation will be no problem either. We proceed according to the formula for inverse CWT taken from the literature.
There is, however, one disadvantage - there are too many calculations and memory consumption. My current computer (it was a good one three years ago) takes 15-20 seconds to process pieces of price series with 2000-3000 counts. Although C++ code is highly optimized - it uses convolution theorem and one of the fastest Fourier transform libraries in the world. Yes... You can't program this kind of code in MQL.

Now, I want to talk about the first steps made in CWT towards market analysis and search for methods of price curves extrapolation.

I started with Morlet wavelet. CWT with this wavelet is equivalent to a Fourier transform with a Gaussian window. Well, it's written about it in all the textbooks... By adjusting just one parameter of the wavelet, you can change the ratio of its widths in the time and frequency domains. This is convenient.
What follows is an illustration of a CWT result ( coefficients of decomposition are displayed in conventional colours where highs are lighter and lows are darker) for EURUSD series - one-hour close prices. The piece is taken from history - where exactly, I think, is not important now. Below is the given price series.
What can we say here? The fractality of the market is clearly visible. The maximums and minimums of the price curve are well localized. Not so easy, but the structures in the picture can be associated with the trend channels at different scales. What else? Note - you can see a remarkable fact - the market doesn't like some scales!



I've shown quite a typical picture here. If we make several of such pictures over time and put them next to each other, we can see how some structures emerge, develop, then disappear, being replaced by others. One can even get the illusion of a pattern. It is also good to translate the pictures into a three-dimensional representation. To get a better handle on it, I want to make a movie out of such pictures. But it's going to take a long time...
Other wavelets give similar pictures, but with Morlais their interpretation is more direct.
So I've settled on it for now.

Apart from looking at such pictures you can do more meaningful things.
Well, for example to get wavelet spectra. It is possible because Parseval's theorem works for wavelets. In case of Morlet wavelet, its spectrum is an analogue of the Fourier spectrum but it is highly smoothed and scaled otherwise. However, for analysis, it is heaven and earth. I had looked at many Fourier spectra for price series sections but failed to come to any certain conclusions looking at those fences. Here everything looks clear and logical. However it may be a long talk about these spectra. Let's not talk about it here and not now. Sorry, I'm not posting the picture yet. I just have it in another computer - I have to get it. If it is interesting I will post it later.

Now the extrapolation. Let's extrapolate the CWT matrix instead of the row itself. How? I will not talk about the details, respecting the copyright law. But there is a cool and very non-trivial idea. Something tells me in my gut that you can either do a great thing here, or... ...or you can make a very big mistake. Either way, you'll understand my motives for secrecy. I need to implement my ideas into code, test them on the story and on the demo, digest these results - then we can say something. All this, alas, is a long time.
Just to show you the results of extrapolation of a part of a price series 200 samples forward (blue curve).



Of course it does not always work so well, but quite often. I didn't check how often. There is no sense in it. This was the very first attempt. The algorithm is a primitive, the first thing that came to mind. Now I have given it all up.

The end. Thanks for your attention!
Off to work, the rest is in the order of discussion.

Good luck to all and good trends!
 
to Andre69
...You are first of all differentiating the price series. By doing so, notice, you throw out a good portion of the low- and medium-frequency harmonics of the series! For statistics, of course, this approach is sensible. But aren't we throwing the baby out with the water here...?

When differentiating, information about the low-frequency component of the signal is not lost. Indeed, after integrating the residual series, we get the original time series with all the trends plus some constant. Hence, residualization of the original series by differentiation is quite correct from the mathematical point of view. Here, however, there is another trap: it generates false correlation of neighbour samples, but that is a separate story.
Otherwise, Andre69, I agree with you. And thanks for informative answers.

to Yurixx
But if you take something more complicated, a polynomial of degree 2, for example, it's not quite the same.
Let me clarify: we are talking about extrapolation to the near future.
So, with a simple quadratic function (assuming that the number series really allows it by nature) you can predict the approximation of the pivot point. And that's exactly what everyone needs. Especially polynomials of higher powers.

I started to write down formulas for interpolation of time series in general case by polynomials of degree n and do you know what I got as a result? - Taylor's series expansion (RT) in the vicinity of some point! I was astonished of my genius :-) and having thought a little, I came to a conclusion that it should be so. After all, in fact RT is an approximation to the initial function at a point by summing polynomials of higher and lower powers with smaller and lower weights, which model behavior of the first, second, ..., n-1 derivatives. By definition, this apparatus can be used if the initial series is smooth, i.e. derivatives up to n-1 are defined and exist. BP of financial instruments does not belong to the smooth class, so we cannot apply RT decomposition or, what is the same, use extrapolation by polynomials.
By the way, the smoothness of the series is nothing but the positivity of CA! That is, the series is more likely to continue the movement started than to change direction. Yes, that's it! Looks like we need to create a section of mathematics in the study of NOT smooth functions and methods of their analysis...

to Candid
About a year and a half ago I was actively engaged in extrapolation of BP using Fourier analysis. I wrote a program, which sums up an arbitrary, preset number of harmonics and extends them by a given number of samples into the future. To check the code correctness, I digitized the sound of the very first piano key (for the curious, the LO subcontract contains more than 500 harmonics and is very difficult to analyse), sent a code to this series and got their extrapolation for a few periods of the fundamental ahead. The result stunned me with its beauty - the sound was indistinguishable from the real one. That is, my code perfectly predicted the further behaviour of this bloody jumble of sounds!!!! Overjoyed, I was ready to tear up the Market... but the market didn't see me. It stepped over me, a heavily armed soldier, and went on its way! It turned out that there were NO fixed harmonics on the market...
 
to Candid
The whole point turned out to be that there are NO stationary harmonics on the market...

I thought I had accounted for that :). The extrapolation coefficients for each harmonic were re-calculated on each bar. The base was equal to a quarter of the harmonic period, the extrapolation length one eighth of the period. In addition, the goal was not to obtain a continuous forecast. The aim was to get a good forecast for at least some sections and then try to understand how these sections differ from other sections. Alas, the resulting forecast showed prices about the same way a stopped clock shows time :)
 
To Neutron, Candid.

I actually meant a bit (or rather, TOTALLY) differently, not harmonic folding. OK, I'll take my time and check it out.
Reason: