Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
This is a very general statement with no specific information. You could for example replace the word "FA" with the word "lap dance", and the whole thing still would make sense!
Even if we are not experts of Fourier and Hilbert transforms or Goertzel algorithms, there is nothing bad to try to improve our knowledge. I think the question is justified, whether methods developped be physicists and engineers can be easily applied to trading.
It is true that I understand little about the subject, but further learning would certainly overcharge my limited mathematical capabilities, so I am falling back to heuristics, thing most traders do, when faced with a complex situation. And my heuristics tells me that sentiment and correlations might be more important than assumed cycles.
Alas I think you have convinced me to avoid the stock market, haha. I suppose my dreams of sweeping in on the bottom of supposed cycles and coming out at the crest have been crushed (with good reason.)
Thank you for the technical response - it is nice to hear from an expert and I assure you that experts in this area are far and few in between (at least my limited experience has taught me so.)
Just to clarify for everybody else: Fourier Series and Fourier Transforms are two totally different things.
A Fourier series is just a function with a collection of these terms:
a1*cos(n*x) + b1*sin(n*x)
where if you keep going, my 8 part Fourier series would look something like this:
a1*cos(n*x) + b1*sin(n*x) + .... a8*cos(n*x) + b8*sin(n*x)
Now Fourier Transforms are ugly sons of bitches. I still don't completely understand them and I honestly don't think most people do. I know in about 3 lines of code, we used them to reconstruct raw MRI data from an MRI machine to the nice pictures you're used to seeing from MRI's but other than that it's kind of a mystery to me. I can tell you that if you have a sound signal, a Fourier Transform will show you the frequencies that are in the signal and their prominence.
I am certainly not an expert. I am just suspicious. It is easy to give a meaning to any random set of data. If you flip a coin a thousand times, you will find cycles and trends, and it is all smoke and mirrors. Of course, there are real cycles that exist. The daily cycle that repeats itself, which affects volatility in the first place. There is a seasonal cycle, which is obvious for agriculturals and some energy products. Also there is a weekly cycle, which affects the behaviour of trades. The Monday night session typically has a higher volatility than the Tuesday night session, as the news of the weekend need to be digested. If there are cyclical patterns, you also may find them in high frequency analysis of trades.
But then I think that markets are less cyclical and more driven by non-linear dynamics. So the model that I have in mind is not the model of a pendulum, but a multi-agent model, where the agent's behaviour relies on feedback. Such a model can produce temporary oscillations (such as the hog or cattle cycle), but they are instable and dissolve. Timeseries of market data are non-stationary, probability distribution shift from Gaussian to non-Gaussian, when feedback reinforces.
I do not remember, where I have seen this model of a planetary motion with only three or four planets that looked cyclical but then suddenly one of the planets disappeared in outer space... the cyclical behaviour was just an illusion. I also like the Sugarscape simulation, it also shows pseudo-cyclical behaviour, before it drifts away.
Thanks for the great read thus far, yes I'm resurrecting an old thread.
The last post does well to explain the difference in Fourier Series (assumed cycles) and the Fourier Transform (which supposedly can be used on aperiodic waves).
I've been playing with these a bit, and believe it or not, at work the extremely awful Thomson Smart platform actually has indicators that utilize Fast Fourier Smoothing (ffS). There's also one called ffD which is described as "the exact analytical derivative of ffS." Unfortunately I would post screen shots but my work, at a financial firm no less, blocks me from accessing this site.
I've been looking at it for a few days now, and particularly smaller time frames. Mostly looking at CL just to see plenty of actions and trades. In that time frame, using it to trade, it's performing pretty well with the system I've developed (and rather quickly).
I'm still trying to recreate the indicators on a better futures trading platform since Thomson Smart is a black box and doesn't reveal coding. Here's what I know about it for sure:
ffS:
1. Uses the Fast Fourier Transfrom (FFT) to break the price "signal" into component sine waves, and translates that data into an array. That data now exists on the frequency domain, no longer on time.
2. ffS, somehow, identifies the first harmonic then depending on your input will keep the first X amount of harmonic frequencies, it then sets all other frequencies to zero.
3. The newly scrubbed frequency spectrum is translated back into the time domain via the Inverse Fourier Transform.
4. The result is a very smooth line (like a moving average) that tracks price. The fewer the harmonics you specify, the flatter the line.
Thus far I've been using the ffS as a filter to decide if long/short positions should be taken. An increasing 5 harmonic ffs means long is available. And vice versa.
ffD:
1. It says "exact analytical derivative" of ffS but I haven't worked out exactly what that means yet. It can be, at least crudely, reconstructed by taking ffs[0] - ffs[1].
I've been using ffD to determine preciesely when to enter trades.
There's some very glaring concerns for these to be fully deployed in a system though. Like, for example, these lines repaint. I know for some that is an instant dealbreaker, but to me, that just makes their value probabilistic instead of determined.
Just laying this out here in case this information is helpful. And if there's any MultiCharts .NET (c#) wizards out there interested in recreating these indicators for that platform, I'd love the help. I'm neither a mathematician nor a programmer naturally.
1. Is the result of a Fourier Transformation a series of over-lapping waves of different amplitudes and frequencies?
2. What does, "That data now exists on the frequency domain, no longer on time." mean?
1. Yes. It breaks the price curve into its component waves. FFT supposedly allows an infinite number of component waves to be generated, I've generally seen most indicators limit the waves generated to ~50.
2. The FFT eliminates time as a datapoint. The result is a bunch of component waves. Graphed, the y-axis would be amplitude, the x-axis frequency. Like so:
Ehlers' code appears (I could be wrong) to merely record the "strongest" frequency on this plot and determine that as the price curve's "dominant cycle."
The smoothing technique I mentioned merely filters out the "weaker" frequencies to attempt to eliminate signal "noise." Noise in our case meaning outlier price swings that just juke the price action. It's unfounded if this is actually a valid technique, but the quick and dirty results I've used by paper trading it at work makes me think it warrants further study.
Furthermore, I've found a few academic papers that use FFT for data extrapolation. That's getting even further into the pipe dream, but could be really beneficial if the patterns hold, or at least give a good initial jump into the right direction. Here's the only financial indicator I've found that attempts to use FFT in this manner:
1. I think it would be interesting to see the component waves - like the top 5. plotted in a panel under the price action. The time axis is maintained then each wave would "start" at a different point, but then as each is a different length there will be times when the waves align, eg all peaking at about the same time, and at other times all troughing at together, and other times all perfectly out-of-sync times (peaks coinciding with troughs).
So rather than extrapolation I would like to see the waves and the price movement interaction.
Fwiw, I have something similar to that already. I tweaked Ehlers' code in the link below to plot his "Pwr" variable. It's annoying because it required loads of copy/paste to create 20 (there are 50 possible) plots for it. Not sure if we're supposed to post code in forums but I'll share if you're interested in seeing it in C#. It's by no means a completed work. Here's the paper from Ehlers:
He tries to use the Fourier Transform as a means to find dominant cycle, an approach that sounds like you might also be interested in seeing. He disregards FFT as an inferior approach to his own MESA research for determining dominant cycle (and therefore a self-setting and correcting indicator lookback period). For me, though, I'm looking at FFT as a noise reduction means.
Ehlers' other work has some pretty good merit. His Fisher Transform indicator is superb at detecting market turns, and there's an edge when instead of taking trading signals just from the turns, you wait for bullish/bearish divergences. It's a great base to build a strategy off of, it just needs some good filtering criteria:
I think many traders think that the market moves in cycles. After many many years of screen time, I've come to believe that the market moves in Waves like the ocean, rather than cycles. Cycles imply a fixed period. The period of the market is constantly expanding and contracting. (Like ocean waves).
Cycles do present themselves on occasion but are usually too short lived to be tradable, too short for daytrading anyway.
I talked to Mr. Ehlers many years ago and he told me that his cycle research came from his work in the oil industry. He then adapted it to the markets. (just a bit of trivia).