Help with Fourier - page 4

 
I'll try to ramble on :))

Let me start with the background - about two hundred years ago, there was a strange man living in France, named Fourier. Those were the times.
Bonaparte, the guillotine, the terror and all that, but the guy was fixated on something else - mathematics. And somehow, whether from the malaise or from boredom, he proved the theorem that any periodic function given on a finite interval can be expanded into a series of harmonic functions. But if think twice it turns out that he has found out how to fulfil the blue dream of any trader - to accurately predict the price of a currency pair for any time interval.

Indeed, if you decompose that curve, which draws a currency pair rate into a harmonic series and then extrapolate each harmonic separately for a given time interval - an hour, a day or a week and then sum the values of all the harmonics at a given point, you should get exactly the value that will be the rate of this pair in an hour, a day or a week! And everything is fair, everything is scientific! And everything should work! It should... but it doesn't!

These are two questions that immediately arise - who is to blame and what to do? And if the first traditionally, thinly or slightly can be sorted out, then with the second - full ... dark forest.

You may understand why we cannot extrapolate the price of the currency pair if we carry out a couple of mental experiments - to begin with we can use the following
start by making a jumble of sine-cosine functions with different amplitudes and frequencies, add polynomials of different powers, logarithms, etc., and mix it all with a random generator
simulating noise to make it more similar to the truth and then graph this gibberish, the result will probably be something similar to a currency pair rate.

Further, if you decompose the obtained curve into a harmonic series and then extrapolate harmonics, everything will work as it should be and the future will be predicted with enviable ease even if the noise level is rather high. Why the same cannot be done with the real course?

To understand this, we can try a second experiment - create a dozen of similar sets with different ratios of various functions and start launching an arbitrary set at arbitrary points of time - of course making sure there are no gaps in the chart - this is where transformations really start to go slow - because as
or to put the problem in a more scientific way - due to the fact that the time series forming the graph is not stationary.

The fact that financial markets demonstrate rather frequent, spontaneous and poorly predictable changes of trends, or in our case - changes of function sets, can be understood, if we remember that currency rates are determined not only and not so much by the smooth economic laws, as by the psychology of a crowd, whose mood can vary unpredictably. That is why the idea of accurate rate prediction based on conversions seems to be unrealizable.

But maybe klot is right and we can try to learn to recognize different types of spectra and use their changes for estimating the market transition from one state to another and thus start one trading strategy or another. That is, on the basis of the Fourier analysis and a neural network we can make a smart indicator or a market state filter.

In principle, the idea is original, fundamental, deeply scientific, though complicated. But as you know, the devil is in the details. In my opinion, those "trifles" that the idea can stumble upon are noises and volatility.

Indeed, spectrum of a real signal consists of trending, periodic and noise components. When moving from one type of spectrum to another one due to the fact that they both have noise components it will be impossible to understand within a while which spectrum set is old or new. The result may be as usual - the system recognizes well a shift to a different type of spectrum, when the flat has long changed into a trend or vice versa.

The second problem may be the volatility. Its growth will first of all lead to growth of the noise component and therefore increase "dead time" for recognizing a new spectrum. Since change of trends often occurs at higher volatility, it also becomes a problem.
Having made an appropriate normalization by volume, we can try to somehow "roughen" sensitivity of a neural network at high volumes and "sharpen" it at low ones.

In conclusion it may be noted that Fourier's example was contagious and many gentlemen with mathematical ability created their own transformations - Wigner, Walsh, Hilbert... the list is long enough. Among newer ones - spectral singular analysis (SSA) that gives good separation of trend, periodic and noise components and wavelet analysis best suited for non-stationary time series.
 

It would be interesting to implement an indicator similar to a spectrum analyzer by the frequencies and amplitudes of frequency components expanded in one window; the infra-low frequencies with large amplitude would correspond to a trend, mid- and high frequencies - to a flat and noise respectively; despite the fact that the price movement is not stationary periodic, but rather a temporary periodic, this indicator would show the market situation well.

 
The trend can be picked out. BUT Fourier has one disadvantage, I have already written about it above. We take a fixed section and in order to perform the transformation we multiply this section in both directions to infinity, as a result we have a continuous signal (course) in infinity time, because sine waves are continuous. Example, our price slice is 10, 11, 12, 13, 12, to do the conversion we need to make a continuous series out of it ... 10, 11, 12, 13, 12, [10, 11, 12, 13, 12], 10, 11, 12, 13, 12, ... The result, the future price is clearly known, it's 10, that's why Fourier doesn't work. To apply the idea of frequencies we need to find another decomposition method. For example, you can clearly define several frequencies and by enumeration method, minimizing the error, select for them the values of amplitudes and phases, we will get a trend, but for this you need a very powerful computer.
 
Actually Fourier extrapolation works, you just have to know how to set it up. Causes and cycles have already formed over the previous sections of the trend, which give rise to an effect. And if you take that into account, the prediction is more than 60-70 per cent accurate, which is enough to have a profitability of 2 or more. And on slow fluctuations, like days or more the accuracy is very high. I don't know any other tool that could do it. I've mostly been able to predict market trajectory as early as 2-4 months before it happens. But even on short distances a day or two before, the prediction accuracy is quite acceptable. And that's without developing the principle deeply enough. I'm pretty sure that with a capital approach you can get accuracy close to 90%.

 
ANG3110, can you post a screenshot showing the whole period of the Fourier extrapolation, you can only see the end, but I would like to see all the analysed data.
 
ANG3110 писал (а):
Actually Fourier extrapolation works, you just have to know how to set it up. Causes and cycles have already formed over the previous sections of the trend, which give rise to an effect. And if you take that into account, the prediction is more than 60-70 per cent accurate, which is enough to have a profitability of 2 or more. And on slow fluctuations, like days or more the accuracy is very high. I don't know any other tool that could do it. I've mostly been able to predict market trajectory as early as 2-4 months before it happens. But even on short distances a day or two before, the prediction accuracy is quite acceptable. And that's without developing the principle deeply enough. I'm pretty sure that with a capital approach you can get accuracy close to 90%.

In my opinion, this is one of the most promising forecasting methods.
Would it be possible to know how the forecast accuracy of 60-70% (which is really not insignificant) is determined ?
If it's not a secret, I'd like to see the code or at least a test report.
 
What is meant by prediction accuracy?
 
ANG3110:
Actually Fourier extrapolation works, you just have to know how to set it up. Causes and cycles have already formed over the previous sections of the trend, which give rise to an effect. And if you take that into account, the prediction is more than 60-70 per cent accurate, which is enough to have a profitability of 2 or more. And on slow fluctuations, like days or more the accuracy is very high. I don't know any other tool that could do it. I've mostly been able to predict market trajectory as early as 2-4 months before it happens. But even on short distances in a day or two the prediction accuracy is quite acceptable. And that's without developing the principle deeply enough. I'm pretty sure that with a capital approach you can get accuracy close to 90%.



Let me repeat - real quotes from a mathematical point of view are
a set of sections with different functional dependencies, so
the spectral decomposition will be different at each such section. If
can find such an area of the expansion where the functional dependence has not changed yet
, then until it changes - the Fourier function will more or less
tolerably predict the behavior of the price, but only until. It would seem
in such a case one could always select small portions of the preceding
course and use them for decomposition/extrapolation, but then the
low-frequency part of the spectrum is lost and the noise increases.

But even in the area where the functional dependence has remained unchanged
prediction will not be accurate, because firstly Fourier does not work
with non-stationary time series, and real market quotes
are non-stationary, in this sense it is better to use waiflets.
Secondly, market quotes are closer to fractal functions, that is
if the decomposition is built for a certain timeframe and on this
timeframe more or less works, for smaller timeframes
it does not work, there on this interval there is a series of their own
fractals with their decompositions, which for a larger TF can be
considered as noise. All this is imho of course.

Well, as for the fact that one should know how to use Fourier - it's about the same
as saying - of course technical analysis works, one should only know how to
use it.
 
lsv писал (а):
ANG3110, can you post a screenshot showing the entire period of the Fourier extrapolation, you can only see the end, but I would like to see all the analyzed data.
Showing pictures would certainly be possible. I have only given a small section of one of the short variants. Several variants at different durations are plotted and those that repeat well and correlate well with the real signal by minimum RMS.
That is, it is not a single picture but a complex. This subject is too vast to show only one graph, it will be a special case.
 
SK. писал (а):
ANG3110 wrote (a):
Actually Fourier extrapolation works, you just have to know how to set it up. Causes and cycles have already formed over the previous sections of the trend, which give the consequence. And if you take that into account, the prediction is more than 60-70 per cent accurate, which is enough to have a profitability of 2 or more. And on slow fluctuations, like days or more the accuracy is very high. I don't know any other tool that could do it. I've mostly been able to predict market trajectory as early as 2-4 months before it happens. But even on short distances a day or two before, the prediction accuracy is quite acceptable. And that's without developing the principle deeply enough. I'm pretty sure that with a capital approach you can get accuracy close to 90%.

In my opinion, this is one of the most promising forecasting methods.
Would it be possible to know how the forecast accuracy of 60-70% (which is really not insignificant) is determined ?
If it's not a secret, I'd like to see the code or at least a test report.

I'm glad you share my views on the application of Fourier harmonic analysis forecasts.
The accuracy of the forecast was calculated at a glance, from memory, for I've been using this method occasionally for over half a year. Of course, I also ran it on historical data. I have to work with statistics to give a more accurate estimate. I cannot see the test report because it is simply missing. I tried to automate the forecast, but every time I was either very tired from overstrain, or made some mistakes that got me stuck for a long time. Therefore automation has been postponed for the time being.