Fourier transform and moving averages
Forums › ProRealTime English forum › ProOrder support › Fourier transform and moving averages
- This topic has 21 replies, 7 voices, and was last updated 3 months ago by KumoNoJuzza.
-
-
08/07/2024 at 8:47 AM #23619308/07/2024 at 9:00 AM #236197
Yes, you have to code a strategy, using the ProRealTime (often named ProBuilder) language, and backtest it.
08/07/2024 at 9:03 AM #23619808/07/2024 at 9:18 AM #236199This should help
08/07/2024 at 9:29 AM #236200With Python I can put the moving averages into the Fourier transform and compare them with the normal signal after the signal is received and do a back test. Do you think this is possible?
Yes, with Python you do this with a couple of lines of code. With PRT (ProBuilder) it is sheer impossible (but theoretically can be done).
Most probably you will never get an answer from your code because all will be way too slow.08/07/2024 at 9:48 AM #236204Hi,
The library contains this indicator “Fourier Transform” …
https://www.prorealcode.com/prorealtime-indicators/fourier-transform/
I understand that you want to convert the time domain to a frequency domain using the Fourier Transform, but what added value does this have on average…?
The characteristics of an average are fully captured in the time domain by means of the impulse response… (here the frequency domain has no added value)
What you can do in PRT, as Roberto points out, is code your system (with average) in PRT and then back test it…
A simple strategy with average:
// Moving Average type
//0=SMA, 1=EMA, 2=WMA, 3=Wilder, 4=Triangular, 5=End point, 6=TimeSeries Forecast, 7=Hull, 8=ZeroLag
DefParam CumulateOrders=False
Once SlowPeriod=20
Once FastPeriod=10
MASlow=Average[SlowPeriod,MAtype]
MAFast=Average[FastPeriod,MAtype]
If MAFast crosses over MASlow then
Buy 1 contract at Market
EndIf
If MAFast crosses under MASlow then
SellShort 1 contract at Market
EndIf
You can then back test the above system in PRT…
08/07/2024 at 9:59 AM #236206First of all, thank you,
When I finished the course, I was given real world project. The topic I have been given is to take the normal signal of the moving averages and then take the signal by putting it into the Fourier transform. Finally I compare these signals and do a backtest.I have searched various sites, books to understand this issue. For 3 weeks08/07/2024 at 10:20 AM #236208Hi,
Just out of curiosity and to learn…
Take a Signal=Average[10](Close)
In the time domain, the impulse response, for the above signal, gives a rectangular impulse with a length of 10 units and a (constant) amplitude of 0.1…
What kind of signal did you get back from the Fourier Transform…?
08/07/2024 at 1:17 PM #236220Hi,
It’s curious that we want to assimilate the curve of an action to an electrical signal (for example) and do a Fourier transform? This is nonsense. An electrical signal is completely defined by mathematics (physical science) where you can work in a spectral domain as well in time domain, while trading is closer to the human sciences where profit is the driving force of stock movements (curve not defined by mathematical functions).
08/07/2024 at 2:36 PM #236223Hi,
Many (famous) traders and hedge funds, use mathematical and statistical functions to define the characteristics of the price signal… Is that all nonsense?
According to you, “the profit is the driving force of stock movements” …
How do you describe this relation between the profit and stock movements?
p.s. is not all sciences human sciences?
08/07/2024 at 2:44 PM #236224Hello @Quino,
Although I never used anything of it for real**, I myself am sort of convinced that a lot of Electrical Engineering can be applied to Price Signals as well.
Just for fun : look at the “development” of a steep electrical signal, which as you may know is build from sines – all electrical signals are build from sines – also perceived squares.**): Not by means of the math meant for it but for Fx I most certainly apply the Entries exactly like that (wait for the signal (= Price) to “evolve”).
There is much more to this and Jaap (JS) knows this better than me, and I think he even attempted to create technical signals around this.
Jaap, how did you fare with this ? you started out with that over here in PRT – I think you thought I was making fun of it, but I was not at all and I really think this is an approach (for technical systems/strategies).
I suppose @herchell got this “real world project” because it just might be one; I am not the type of reading “trader” books – or internet pages for that matter – but I think II can see how an (inverse) FFT can bring sensical data from frequency to time and vise versa (the FFT is all about that). For example, I think you will be able to dig up the similarities per instrument, if you only compare them by FFT means. What to do with that ? no idea; I can’t cope with all the idea I have and working them out, to begin with.🙂
Edit: cross-posted with JS.
08/07/2024 at 2:54 PM #236226Jaap, how did you fare with this ? you started out with that over here in PRT
Over where?? 🙂
Was ‘here’ supposed to be a clickable link?08/07/2024 at 2:55 PM #23622708/07/2024 at 2:58 PM #236228This is from about the first Google result I ran into : Handling Stock Data using the Fast Fourier Transform
I only read a little into it, but I think it is a good read. The website presenting this, heads it under “Physics”. Nice eh ?
Anyway, to work this out in a workable fashion, requires quite come coding, line for the “bins” in order (this will be about filtering out noise).
1 user thanked author for this post.
08/07/2024 at 3:28 PM #236230Hi @PeterSt
System finally runs well (after 3 years) …
System is based on statistics, such as the standard deviation and the normal distribution …
Key features:
- Time frame 1 second (to be as close as possible to the “tick data”)
- Trailing Stop
- Only “Long”
- Only RTH (Real Trading Hours)
- Only Dow Jones (IG & IB)
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on