0% found this document useful (0 votes)
253 views4 pages

142FFT

Fourier analysis is the process of decomposing seemingly complex, chaotic data. Each cycle is a portion of a larger, or fundamental, cycle length. A sinusoid with a frequency of 20 cycles per year has a period of 260 / 20 or 13 days.

Uploaded by

Eduardo Ferreira
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views4 pages

142FFT

Fourier analysis is the process of decomposing seemingly complex, chaotic data. Each cycle is a portion of a larger, or fundamental, cycle length. A sinusoid with a frequency of 20 cycles per year has a period of 260 / 20 or 13 days.

Uploaded by

Eduardo Ferreira
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Stocks & Commodities V.

20:7 (58-61): Fast Fourier Transformation by Amy Wu CYCLICAL ANALYSIS

Identifying Patterns

Fast Fourier Transform


Dont overlook cycles when youre analyzing security prices. by Amy Wu or a long time, Fourier transforms were used mostly by engineers. Transforms were used to study sound waves, frequency vibrations, and other repetitive occurrences. Since then, Fourier transforms have been applied to a number of other diverse fields. Aerospace engineers use them to study a planes wing-tip vibrations during flight, while musicians use them to identify patterns when strumming musical instruments. It was only a matter of time before someone used Fourier transforms for technical analysis, specifically, a type of calculation called the fast Fourier transform (FFT). Jack Hutson and Anthony Warren of STOCKS & COMMODITIES were early proponents of applying fast Fourier transforms to price movements in security prices.

FOURIER ANALYSIS
Before delving into FFT, it is important to understand the basic principle underlying Fourier transforms. Fourier analysis is the process of decomposing seemingly complex, chaotic data into a sum of sinusoids of different cycle lengths. Each cycle is a portion of a larger, or fundamental, cycle length. Developed by Jean Baptiste Fourier in 1807, Fourier analysis proves that any given waveform can be broken down into a combination of sinewaves of different amplitude (maximum value), frequency (rate of vibration), and phase the three basic properties of cycles. Each sinusoid is characterized by these three properties. The period or cycle length of the sinusoid is calculated by dividing the number of trading days per year (assumed to be 260) by the frequency. For example, a sinusoid with a frequency of 20 cycles per year has a period of 260/20 or 13 days. Fourier analysis is also referred to as spectral analysis. It provides a quantitative tool for identifying the dominant frequencies or frequency bands in any data. The actual procedure of Fourier analysis is complex and mathematically rigorous, but it is possible to give a simplified expression with stable waveforms. The lowest of the waveforms, the base, is known as the fundamental. The others are referred to as harmonics. Think of this as if you are listening to someone play the piano. Your brain can differentiate the theme of the piece (the melody) from other chords (the harmony).
CHRISTINE MORRISON

Suppose, however, that waveforms are nonrepeating. In fact, Fourier analysis can be applied to nonrepeating waveforms. But this requires certain characteristics of cycles such as phase to be disregarded.

FAST FOURIER TRANSFORMS


The key to using FFT as an indicator is the interpretation of the cycle breakdowns. Fortunately, FFT is built into most trading programs like MetaStock, so there is no need to perform the calculations manually. Figure 1 displays a chart of Ford Motor Co. (F) with the Fourier transform. You can see three predominant cycles of 341 days, 64 days, and 102 days. The most significant cycle is displayed on the left, and the least significant on the right. Once you know the cycle length, you can use it to determine your parameters for other indicators as specifically as possible. One of the simplest ways to use such information is in selecting the length of a moving average. You can do this by determining the cutoff frequency of the moving average, or the length that rejects unwanted noise. This is calculated by dividing the cycle length by two. You can also use FFT independently to gauge the points of the coming cycles. (For more details on the FFT, see the sidebar, What is a fast Fourier transform?)

Copyright (c) Technical Analysis Inc.

Stocks & Commodities V. 20:7 (58-61): Fast Fourier Transformation by Amy Wu

FIGURE 1: FORD MOTOR COMPANY (F). The various cycle lengths are displayed in the subchart below the price chart. The most significant cycle is on the left and the least significant on the right.

WHAT IS A FAST FOURIER TRANSFORM? There is an intuitive appeal in the concept that cycles are apparent in price data. The cycles do not appear to be consistent, but more of a combination that are longer- and shorter-term cycles added together. This creates a market of upward movements with countertrend declines and downward movements with countertrend rallies. Now look at an example of this process. In sidebar Figure 1, the line labeled A+B+C is a composite or a summation of waves beginning with the trend (labeled C) and the two wave forms labeled A and B. If we look at one cycle of wave A, we can see that from point 1 to point 64 is one wave. The wave then repeats over the next set of data points. If we look at wave B, we can see that this wave repeats five times from data point 1 to data point 64. So with respect to our 64-point time period, we can say that wave A has a frequency of one cycle per 64 data points and wave B has a frequency of five cycles per 64 data points. The cycle length is the inverse of frequency. If the data points were days, then wave As cycle length would be 64 days and wave Bs would be 12.8 days (sidebar Figure 2). A fast Fourier transform (FFT) is a mathematical function that transforms data in a time function into a frequency function. For example, traders look at data in a time function; the x-axis of the graph is in units of time such as days, and the y-axis is price. An FFT transforms the data such that the x-axis is now in units of frequency and the y-

SIDEBAR FIGURE 1: CYCLES. The wave labeled A+B+C is made up of a trend (trend C) and two cycles summed, cycle A and cycle B.

axis is the power of the cycle at that frequency. The FFT decomposes the summed cycles such as wave A+B (sidebar Figure 3) into separate cycles and then plots the power versus frequency of each cycle. This is called a power spectrum. In sidebar Figure 4, we see a power spectrum of the summed wave A and B from sidebar Figure 3. This power spectrum displays the information about the two cycles; the frequency is one and five. Fast Fourier transforms have three requirements about the data being analyzed. First, the data must have the major trend removed, as a cycle length longer than the data being analyzed will skew the values of the power spectrum. In sidebar Figure 1, the trend would need to be removed from the data labeled A+B+C before running the FFT.

Copyright (c) Technical Analysis Inc.

METASTOCK (EQUIS INTERNATIONAL)

Stocks & Commodities V. 20:7 (58-61): Fast Fourier Transformation by Amy Wu

A B

SIDEBAR FIGURE 2: CYCLE A AND CYCLE B. Cycle A has a cycle length of 64 periods or a frequency of one cycle per 64 periods. Cycle B has a cycle length of 12.8 periods or a frequency of five cycles per 64 periods.

SIDEBAR FIGURE 3: SUMMED CYCLES. Adding the two sinewaves together produces a composite cycle.

SIDEBAR FIGURE 4: POWER SPECTRUM. The power spectrum shows the power of the two cycles. Cycle A is the dominant cycle (the highest power) with a frequency of 1, while cycle B has a frequency of 5.

SIDEBAR FIGURE 5: HANNING WINDOW. If the data points did not begin and end with zero, a Hanning window is used to remove the discontinuities. Here is the plot of a Hanning window.

One method to remove the trend is to measure the trend using the linear least-squares method and subtract the trend values from the original data. Second, recall the beginning and end points of the data must have approximately the same values for fast Fourier transform. An FFT assumes that the cycles continue to repeat into the future (as they do in sidebar Figure 1 beyond data point 64). If you apply an FFT to data with different beginning and ending points, the output of the FFT will be incorrect. To adjust the data so it has the same beginning and end points, the data must be processed with a Hanning window (sidebar Figure 5). This step will eliminate endpoint discontinuities.

Sidebar Figure 6 is the composite wave (sidebar Figure 3) multiplied by the Hanning window (sidebar Figure 5). The Hanning window introduces an artifact shown in sidebar Figure 7. The power spectrum of the processed data has values on both sides of the peak values, unlike our ideal sidebar Figure 4. Experience shows that windowing real world data has more positive than negative effect on the output. Finally, the last requirement for FFTs: the data period must be a power of 2 that is, 64, 128, 256 or greater periods. Thus, we must augment the data by adding zero to the data so the final array has a value equal to a power of 2.
Thom Hartle

SIDEBAR FIGURE 6: COMPOSITE CYCLE PROCESSED BY HANNING WINDOW. Multiplying the composite cycle by the Hanning window alters the data to look like this.

SIDEBAR FIGURE 7: POWER SPECTRUM. The power spectrum of the data from Figure 6 still retains the peak power levels at the same frequencies.

Copyright (c) Technical Analysis Inc.

Stocks & Commodities V. 20:7 (58-61): Fast Fourier Transformation by Amy Wu

THE DOWNSIDE
When using FFT with securities, it is important to remember several inherent difficulties with security prices: 1 Securities tend to trend. However, trends in security prices can usually be taken care of by some method of detrending. Running a linear regression trendline or using a moving average will usually detrend the security price. 2 Security prices are not necessarily periodic (unless you are looking at specifically cyclic industries). 3 Securities are not continuous: There are weekends and specific holidays when securities are not traded. These discontinuities may obscure parts of the underlying cycle.

correctly, FFT can greatly enhance your accuracy on other, more fitted indicators. Amy Wu is a student at Princeton University majoring in economics and financial engineering.

SUGGESTED READING
Achelis, Steven B. [1995]. Technical Analysis From A To Z, Probus Publishing. Hartle, Thom [1994]. Preprocessing Data And Fast Fourier Transform, Technical Analysis of S TOCKS & COMMODITIES, Volume 12: April. Hutson, Jack K. [1982]. Using Fourier, Technical Analysis of STOCKS & COMMODITIES, Volume 1: February. Meyers, Dennis [1999]. The Discrete Fourier Transform Illusion, Technical Analysis of STOCKS & COMMODITIES, Volume 17: April. Warren, Anthony [1982]. A MiniGuide To Fourier Spectrum Analysis, Technical Analysis of STOCKS & COMMODITIES, Volume 1: February. _____ [1982]. Fourier Analysis! In A Nutshell: Faster And Better, Technical Analysis of STOCKS & COMMODITIES, Volume 1: July.
See Traders Glossary for definition

SUMMARY
Like Elliott waves, the Fourier transform is an area of higher mathematics that has become a staple of technical analysis. For many, however, the elegance of the mathematics is confused with a guarantee of success. What you need to remember when applying the technique is that it isnt pure Fourier analysis; many aspects, such as phase, are being discounted to fit the type of data in use. Still, interpreted

S&C

Copyright (c) Technical Analysis Inc.

You might also like