Hi Andy - I would be interested in seeing the auto-fit version whenever you have the spare time to post it. Thanks very much!
Steve ----- Original Message ----- From: "andy_davidson_uk1" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, October 11, 2006 4:55 AM Subject: [amibroker] Re: Hurst Channels Guys, There's lots of good stuff going on here and I wish I could devote some more time to digest it all (still in a crazy mid-move mess). However, until I can I thought I would just post my own bit of code to show you how I've been using Millard's adaptation of Hurst's work. You'll find it under "Cycle Highlighter" in the AFL library. It's nothing really mathematically fancy I'm afraid and uses simple sine-waves to extrapolate. FFT's, appendix 6 of PM and the like are beyond my skills at present, although I see I'm going to have to do something about that! However, I have found that the simplicity of the approach does help in so far as practical trading goes. By this I mean that if clear, tradeable cycles are present it will generally show up on the indicator. And if they don't show up then neither does my trading money, simple as that! To give you a practical idea of how I've used it...try it on GBP A0-FX with a daily setting of around 85 bars. Now, I didn't use this indicator alone to go short on the currency in early September (there's obviously more to my method than this one indicator), but it has helped me *stay* short until now...i.e. I kept the faith with the position despite a month of down-and-up action because the cycle interp told me there was plenty of down-time still remaining. There is also an auto-fit version available if anyone's interested. It's not perfect and it's slow as it uses a loop to find the best correlation coefficients. But let me know if you want it. I haven't felt the need to code Hurst's edge-band technique as yet, but it's on the list. As is working through his course material in detail and then tackling these higher-order mathematical techniques to try and improve what I've already got. However, I would say that the KISS principle has served me pretty well up until now. So good luck to all and please keep this thread going! Also feel free to let me know if there's any way to improve the code I posted. A programmer I most definitely ain't... --- In [email protected], "Rakesh Sahgal" <[EMAIL PROTECTED]> wrote: > > Fred > > So in essence are you saying that to get a meaningful response from a FFT it > is essential that the data series be de-trended? Also since TJ had in > response to your query indicated that the FFT implementation he was going to > include in AB was not going to be constrained by ^2 limitation requiring > data padding/windowing(?), the problem of ascertaining cycles should be > resolved if the data is detrended and then run through the FFT function in > AB? > > Rakesh > > On 10/11/06, Fred Tonetti <[EMAIL PROTECTED]> wrote: > > > > Bill, > > > > > > > > As a follow up to my last . > > > > > > > > Lets use the wave generator ( below in AFL ) to manufacture some > > synthetic data . > > > > > > > > You can see that I purposely picked wave lengths that are powers of two . > > The reason is that FFT's will of course resolve these quite well as long as > > you have the sample size set to be a power of 2 which is larger then the > > longest wavelength. The amplitudes and phase offsets are pretty much > > random. > > > > > > > > See the attachments . > > > > > > > > #1 The individual and composite ( DATA ) waves we generated > > > > #2 The histogram or periodogram for the FFT . Notice how it picked all > > wave lengths out with very little trouble. > > > > #3 The output cycles which are a result of the individual cycle lengths, > > amplitudes and phase offsets that the FFT detected. Notice how this is > > almost a perfect match of the input. The individual waves can of course be > > easily extrapolated and combined to present a picture of where the data > > should go in the future. > > > > > > > > #4 Another generated wave this time with trend added in . Notice the > > effect on the white composite line. > > > > #5 The resulting histogram from the FFT WITHOUT detrending the data > > first. Notice how it has become "confused". > > > > #6 The resulting output waves now don't look much like the inputs. > > > > > > > > #7 Same histogram as in #5 but with detrending the data prior to invoking > > the FFT. Notice how now we are back to where we should be. > > > > #8 The resulting output waves as we would expect them to be . > > > > > > > > #9 Another generated wave this time with a very high noise level ( the > > grey histogram ). You can see the effect it has had on the data we > > manufactured. > > > > #10 The histogram from FFT. Notice how even though the noise levels have > > gone up here, the FFT still had no real problems finding the cycles. > > > > #11 The resulting output waves which now look very much like the input . > > WITHOUT the noise. > > > > > > > > #12 Here I have purposely changed the wave lengths from being powers of 2 > > to 7, 17, 27, 37 & 47.. Notice the effect it has had in the histogram . I > > had to increase the data sample to 512 to get this resolution which is still > > somewhat "muddy" . but all in all the FFT did a good job of finding the > > cycles. > > > > > > > > The other thing to keep in mind here with this particular wave generator > > is that I have not introduced any variation in wave length, amplitude or > > phase offset over the life of the data sample . which in my opinion . does > > happen . For the purists that don't think this happens, then I would think > > that they would at least admit that non cyclic events can make it appear to > > DSP algorithms as if this were the case. > > > > > > > > rTrend = 0; > > > > rNoise = 0 ; > > > > dFactor = 1; > > > > > > > > rCyc1Amp = 3; > > > > rCyc2Amp = 5; > > > > rCyc3Amp = 7; > > > > rCyc4Amp = 9; > > > > rCyc5Amp = 11; > > > > > > > > rCyc1Len = 4; > > > > rCyc2Len = 8; > > > > rCyc3Len = 16; > > > > rCyc4Len = 32; > > > > rCyc5Len = 64; > > > > > > > > rCyc1Phase = 72; > > > > rCyc2Phase = 144; > > > > rCyc3Phase = 216; > > > > rCyc4Phase = 288; > > > > rCyc5Phase = 360; > > > > > > > > *if* (Source == "Generator" ) > > > > { > > > > pi = 4 * atan (1 ); > > > > > > > > StartX = 1000; > > > > > > > > Trend = (BI + 1) * rTrend * dFactor * (rCyc1Amp + rCyc2Amp + rCyc3Amp > > + rCyc4Amp + rCyc5Amp) / 5 ; > > > > > > > > Noise = (Random () - 0.5 ) * 2 * rNoise * dFactor * (rCyc1Amp + > > rCyc2Amp + rCyc3Amp + rCyc4Amp + rCyc5Amp) / 5 ; > > > > > > > > Cycle1 = cos ((BI / rCyc1Len + rCyc1Phase / 360 ) * 2 * pi) * > > (rCyc1Amp * dFactor) + Trend * 0.2 ; > > > > Cycle2 = cos((BI / rCyc2Len + rCyc2Phase / 360 ) * 2 * pi) * (rCyc2Amp > > * dFactor) + Trend * 0.2 ; > > > > Cycle3 = cos((BI / rCyc3Len + rCyc3Phase / 360 ) * 2 * pi) * (rCyc3Amp > > * dFactor) + Trend * 0.2 ; > > > > Cycle4 = cos((BI / rCyc4Len + rCyc4Phase / 360 ) * 2 * pi) * (rCyc4Amp > > * dFactor) + Trend * 0.2 ; > > > > Cycle5 = cos((BI / rCyc5Len + rCyc5Phase / 360 ) * 2 * pi) * (rCyc5Amp > > * dFactor) + Trend * 0.2 ; > > > > > > > > CycleX = Cycle1 + Cycle2 + Cycle3 + Cycle4 + Cycle5 + Noise; > > > > > > > > * if* (PlotIt == "IP Cycles") > > > > { > > > > Plot (Cycle1, "C1", *colorRed*); > > > > Plot (Cycle2, "C2", *colorOrange*); > > > > Plot (Cycle3, "C3", *colorYellow*); > > > > Plot (Cycle4, "C4", *colorBrightGreen*); > > > > Plot (Cycle5, "C5", *colorBlue*); > > > > Plot (CycleX, "Cx", *colorWhite*, *styleThick *); > > > > Plot (Noise, "n", *colorLightGrey*, *styleThick* | * > > styleHistogram*); > > > > } > > > > > > > > Data = StartX + CycleX; > > > > } > > > > > > > > > > > > > > > > ------------------------------ > > I am using the free version of SPAMfighter for private users. > > It has removed 8605 spam emails to date. > > Paying users do not have this message in their emails. > > Try SPAMfighter <http://www.spamfighter.com/go.asp?t=249> for free now! > > > > > > > Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/amibroker/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
