Predicting the future with Fourier transforms - page 4

 
By the way, yesterday I wrote that the left half-wave period should be shorter and the right one longer. And then the extrapolation would also carry the same law. And today has certainly confirmed this. A swift fall of the euro followed by a slow but intense recovery attempt.
 

Of course, I should allow to use DLL, the dll itself is connected, but it doesn't see the functions in it.

Right, while I'm counting the functions head-on, then maybe mq5 will come out, and classes will appear in it, too.

 
m_keeper:

I think neural networks should be used where it is not possible to draw conclusions using mathematical, statistical, differential or any other analysis.


There is logic in this - NS is not the easiest tool in every respect, so first it is better to squeeze everything possible out of classical ones.


m_keeper:

Don't make anything out of my indicator yet, it's too unfinished.

But it draws beautifully :)
 
ANG3110:
goldtrader:

What if the indicator signal (or rather the difference between the reading and the current price) is sent to the NS input?

May I answer the question, although it wasn't asked to me, as I'm browsing this page.

Actually, the question is not very correct, because there are different networks with different number of inputs and outputs.

There are approximating, classifying and associative ones. With or without a teacher.

But if you assume what the author meant, you can do it. But will the result be satisfactory?

It is clear. I had a more general rather than specific suggestion. The answer from m_keeper is satisfied.

 

Troubled with the indicator for another day

Replaced the fast Fourier transform with ordinary ones, now the window can be set to any length


I experimented with the window size trying to "catch a wave" and found many interesting things

)If there are harmonics, they do not exceed three or four

) These harmonics do not precisely coincide with corresponding market waves by frequency (it would be strange if they did)

)this causes beating during the movement of the window - the phase is lost

we have several non-harmonic frequencies in the market

They can be isolated, as ANG3110 wrote, by the maximum amplitude

Thought about increasing the period to have more harmonics in the range I need.

) If the desired frequency is present over the entire range, it lags,

then it speeds up (non-linearity is evident), it does not phase correctly at the end

)A long period is not very good, there's a lot of extraneous


Actually, two ideas came to mind at the moment.

)Who said that frequencies must be harmonics of main frequency (Fourier probably said that)

1/T 2/T 3/T why not take 10/10T 11/10T 12/10T and we get a higher frequency density

in the range we are interested in.

) why take harmonics at all? We only need to calculate the fundamental frequencies (amplitude and phase)

for all bandwidths smaller than the given one. I think the amplitude plot will be

quite smooth in the low frequency range) we have to take local maxima and these harmonics

can already give a prediction.


And I would also like to ask.

What criterion could be used for determination of amplitude importance depending on frequency?

After all, before looking for local maxima, it would be a good idea to pronormalize the spectrum.

 

PS I think I was wrong about the main frequencies only, at least 2-3 periods should be watched

 

You can simply normalise the window and separately the forecast segment, ci= (Close[i] - min)/(max - min); this improves things a bit, but only slightly. Achieving a coincidence in amplitude is generally quite difficult. Identification of potential pivot points is rather more valuable here.


There, 2-4 harmonics are really optimal. I used to make a drawing script to quickly see what was going on there. I managed to draw curves out of bars. Then the period can be changed with the mouse, and everything is quickly and well visible. Or, another way is to develop an indicator and script to update data in the window, otherwise the indicator's start() function will not be started. It is possible to use the regression channel in the script and send its parameters to the indicator using the global variables, as well as change the number of harmonics by pressing the keys on the keyboard.

#import "user32.dll"
int GetAsyncKeyState(int nVirtKey);
int PostMessageA(int hWnd,int Msg,int wParam,int lParam);
#import
#define WM_COMMAND 0x0111


Then the indicator picture can be moved with the mouse. By the way, the RMS is calculated dc=Close[i]-fx; sq+=dc*dc; and at the end sq=MathSqrt(sq/T); and total amplitudes MathSqrt(ak[k]*ak[k]+bk[k]*bk[k]);

A combination is made by extremums, first roughly by eye, then by minimum RMS and maximum amk;

This is for research in order to see everything quickly. For automation it is a bit different, nothing is done by eye there.

If the phase is floating then there is no standing wave and the forecast will deteriorate. You can put in a mouving or regression, then the phase is more stable. But in principle the phase difference should be used in automation for period auto-tuning, as in radio receivers use phase auto-tuning of frequency.

But this is for one frequency. To increase accuracy, larger and smaller periods are taken and the number of harmonics for all of them from 1 to 5, no more is expedient, and summed up and the average is derived. But once again it's almost impossible to get good prediction all the time with linear time scale. Rather, we need to combine forecast and continuous autotuning. In general, the automation is not simple, though, of course, if it were successful, I believe the trade results would be very good.


 
m_keeper:

And I would also like to ask.

What criterion can be used to determine the significance of amplitude as a function of frequency?

After all, before looking for local maxima, it would be a good idea to pronormalize the spectrum.

Maybe try the normalization proposed by the author of the article (archive, p.17).

Files:
1.zip  246 kb
 

Neutron

I can't find any normal rationing there.


to m_keeper

Try normalizing to total energy.

 

I plotted the periodogram - in the figure below


the rightmost value is the amplitude of the second harmonic of the maximum period

each successive one (one bar, not a harmonic) smaller, and so on, until the period equals the 12th harmonic of the maximum


As I expected, the graph is quite smooth and shows clear local maxima

each maximum corresponds to a frequency and phase already calculated, and the phase at the maximum should

value without any deviations.


All that remains is to plot the whole thing.

Reason: