I also thought about the composite filter outputs issue as well, I suggested that any group of 6 arbitrarily chosen overlapping filters overlapped in such a way that their summed response curves equated to 1 (unity gain), then the composite of the filter output should equal this price output minus the error. The assumes we have a low pass, 4 band pass then a high pass.
Where does the error come from? The Ormsby filters themselves have a small but variable amount of error depending of the number of coefficients. Additionally when we use the ‘digital’ data spacing (eg 7 weeks in the Profit Magic 4.5 year filter) and the smooth the data points between the filter outputs back to say weekly bars, we are losing more accuracy as we are decimating the data points used in calculation then interpolating the spaced outputs back to our original resolution.
Let me demonstrate that it is possible to get the output of 6 filters with equally overlapping filter response curves to match the price very closely.
I will use Octave to demonstrate this and provide the octave functions and script to produce the plots for those who want to play along at home…
In relation to viewing the filter response error, I haven’t figured out how to plot the frequency response from the filter coefficients to show the negative values. Hurst showed the error in the band pass ripple but also the ripple error lobes both positive and negative around 0 in the band stop areas. In octave, after taking an FFT of the filter coefficients then as the absolute (abs) of the FFT is taken to plot the frequency response, the negative error lobes in the stop band become positive.
I am not sure how to take the filter coefficients then plot the frequency response with the negative error lobes as illustrated by Hurst in profit magic? When creating a composite of all the filter frequency responses in order to check how much of the frequency spectrum if close to 1, (passes at source amplitude) then the displayed plot will have values that are higher than they should be where the negative lobes where actually positive due to the use of absolute.
The image below shows what I mean about the filter response Hurst illustrated has negative values.
If anyone knows how to plot the frequency response from the coefficients without using absolute to keep the negatives then I am all ears…
In this example I have used 6 evenly overlapping filters with only 1 bar data spacing for maximum accuracy and all using 1393 weights.
The designed frequency response would be 1 across the entire frequency band. With the Ormsby designs using the above it appears as below. Remember that visually this rippled line around 1 that is the filter bank composite is slightly erroneous (extra positive amounts) due to the negative response that are positive due to the absolute function of the FFT.
The output of these 6 filters compared to price is shown below.
I’m not sure how Hurst computed the with 1% figure, my findings were…
Sum DJIA price data points = 144904.3800
Sum Filter bank outputs = 144695.2712
The absolute difference = 209.1088
The average of the 2 totals = 144799.8256
Difference / Average *100 = 0.144 %
Below is a plot of the 6 filter outputs the low pass is plotted with the price…
Below are the same filters but using data spacing from 7 on low pass down to 2 on high-pass so are less accurate…
And here is the price vs filter output composite, visually you can observe slightly more error…
And here are the filter outputs…
In the less accurate outputs that used data spacing the accuracy calculations for comparison were …
Sum DJIA price data points = 144904.3800
Sum Filter bank outputs = 144468.6397
The absolute difference = 435.74034
The average of the 2 totals = 144686.5098
Difference / Average *100 = 0.3011%
Approx. 2 x less accurate on average …
In summary using a full spectrum filter bank of any different bandwidths does produce a composite very close to the price.
Granted with this perfect overlapping in reality i think it should match the price and it does with only a small percentage of error, even when using spaced data points,
I have not yet been able to find all 6 filter parameters that match the Profit Magic chart, however an exercise such as this at least proves there is not a great deal of error in the filtering process.
Attached are the Octave files you need to produce the above outputs …(remove .csv)
AAA_ormsby_w_calc_f.m - function to create the Ormsby filters.
AAA_Func_filter_series.m - function to apply the filter coefficients to a data array.
AA_HurstDJIA.m - main script file to run with embeded weekly djia price arrays.
AAA_ormsby_w_calc_f.m.csv (6.7 KB)
AAA_Func_filter_series.m.csv (2.4 KB)
AA_HurstDJIA.m.csv (118.6 KB)