Stochastic resonance - page 33

 
Prival, you are a DSP specialist. I've noticed that such experts usually achieve good results on Foreh. Can you recommend some literature, please? You know, DSP itself, theory of information, something else...
 

It seems more or less clear.

We need two arrays of amplitudes, one for the signal and one for the noise. The second array is already entered, since we only need one value from it, we simply store it, thereby freeing up the array for our needs. So, the division should look something like this:

double thr = data1[hmax];
for(i=0;i<N;i++) {
  if (data[i]<thr) {
    data1[i]=data[i]; 
    data[i]=0.0; 
  } else {
    data1[i]=0.0;
  }
}

But it's probably much worse. The reason is that in fact the threshold should be defined for spectral density. The code for its calculation can be taken from my example, but since it contains imaginary and real amplitudes for each frequency, we would have to divide into two arrays not the amplitudes but the frequencies (i.e. indices, with each frequency corresponding to 2 indices: i and i+1). So it looks like we will need 3 more arrays - one for spectral density and two for indices (frequencies): signal and noise. In a word, we'll have to do some serious work and first of all to understand the format of data file for FFT after transformation. The link in klot's library header will help.

As for slowness, without visualizer it would be much more boring, but you can enjoy the process at least :). Minimizing the terminal may speed things up a bit.

P.S. For frequencies you can do with one array - say, write 1 for signal frequencies and -1 for noise frequencies.

 

to Mathemat

You've stumped me :)

  1. Although I can see that your math level is higher than yours. I recommend to start from Yukio Sato's "Signal Processing First Encounter". It deals with physics of processes. At least, for me it has always been so. If I don't understand process physics, I can't apply mathematics either (it's applied :)).
  2. Classic. Marp Jr. Digital Spectral Analysis. IHMO the best book, you don't need to look for others.

What else I think is necessary (useful) for the forex market.

To decide when to enter and exit the market

  1. Wald. Statistical solving functions. Pay special attention to the famous (at least in the field of radar) two threshold Wald detector.

For predicting price movements

  1. Farina. Digital processing of radar information. There pay special attention to the Kalman filter, it is mathematically proved that under certain conditions it is more accurate than not. But there are often problems with these conditions, I have an idea how to use it, moreover Forex market itself removes many limitations.

Statistics, different kinds of distributions and their analysis.

  1. Boris Ruvimovich Levin. Theoretical foundations of statistical radio engineering. The only edition where we could not find an error (typo). Desktop book was when I was writing my dissertation.

Selection of books is a little specific, but just there word target (plane) replace with price (Close[0]), detection of maneuver (on price reversal) and then it becomes clearer what can be applied :)

All save, books attached. All except the last one, sorry.

Once again I appeal to everyone, if you have the opportunity and desire to work as a team, find me on Skype (privalov-sv). Vod link to the walker http://www.skypeclub.ru/skype.htm. It is very handy for communication.

There are plenty of ideas, enough for everyone, there is not enough time and energy. One all can not get up.

Hell, the rest do not fit, does not pass the php. So you have 1 way out :) who needs these books -> Skype, I'm almost always there. Book format djvu

Files:
sato.zip  1353 kb
 

to lna01

"But it's probably a lot worse than that... "

You're right, it will be much worse there, it's only the first stage. The main thing is to understand how to build the indicator correctly and optimise for speed, as formulas will be added and very good ones IHMO. In the future I will need 2 more buffers, for phase analysis + I definitely want to experiment with windows, at least two for sure. Hemming and Butterworth. The first results are encouraging. Try just plotting the amplitude of the 1st harmonic of the spectrum (without any thresholds or sorting). A nice picture is obtained, the first impression is that the kinks determine the moment when the Stop Loss is set. But this still needs to be checked, I will try to post a picture tomorrow.

 

As promised, I'm posting pictures. It turned out to be something very beautiful, you could write an expert now. But there is a mistake somewhere. Maybe I accidentally stumbled on something. Look at please.

Fig.1.

Fig.2

  1. If you change the comparison sign in the line, the histogram disappears (see Fig.2),

if (data[i]<porog) //the comparison with the threshold in this case, there is a histogram

and if so

if (data[i]>porog) // here it is missing

  1. The energy can't be negative and neither can the amplitude, much less their sum !!! :(
  2. But visually very nice, I would call it "Trend-curve energy
  3. ".

P.S. The only question on what I wanted to do in this line of code will not answer (if you find a mistake), see above a general idea of the indicator, what I wanted to get, there everything in the pictures. If you explain in the pictures what I have gotten because of my feeble hands. I will pay for it. I just took the MACD indicator and added it, but it didn't look right.

Files:
pvf2.mq4  4 kb
 
Prival:

But if you can explain in pictures what I got because of my crooked hands. I owe you a vig.


This: for( i=hmax ; i<N;i++) - I still don't understand. I mean, of course it is not necessary to look through all frequencies, but why from hmax?

Secondly, the Fourier transform results in complex amplitudes. So the amplitude for each frequency corresponds to two numbers: the real part and the imaginary part. The energy is equal to the modulus of sqrt((Re+j*Im)*(Re-j*Im)). I can add from myself that Re and Im are often in antiphase. Cutting everything by one threshold is a nontrivial transformation and I cannot think of a physical meaning for it. Anyway, energy has nothing to do with it.
I repeat: need to understand format of data file for FFT after transformation. The link from klot' s library header will help
 

lna01

I figured it out, that's what it's all about, the only thing is that I really got the data format wrong. When I find out the data format (I put the question to klot in the branch) I will sit down with a sheet of paper and a pen to check what adds up. I'm used to matcad. I have got used to dealing with matcad. That is my mistake. Regarding for( i=hmax ; i<N;i++) you should take it from 1 (or even make it a separate variable). Just think, there is a clear physical meaning if we use sqrt((Re+j*Im)*(Re-j*Im)).

 
Prival:

make it a separate variable altogether

That's right :) . If we cut some frequencies and divide the rest into "sub-threshold" and "above-threshold" by energy, there will be no difficulties with the physical sense :)

P.S. Perhaps I mention the indicator too often https://forum.mql4.com/ru/6275 :), but there the work with amplitudes is done correctly - you can just take from it.
 
So what is the red line in Fig.2? The difference of energies of the real and imaginary parts? Very interesting. And what do the numbers in the value area of the indicator mean?
 
There seems to be a bug in the library, or my hands are crooked again :( posted my question here 'FFT Fast Fourier Transform Functions Library') if anyone can check it out. Am I right or not. Try in matlab to check.