[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Hurst Channels



PureBytes Links

Trading Reference Links

I'm with you Fred...especially the "understanding where you fit" part.
And obviously agree with the bit about shorter-term cycles falling
into the 'discretionary' realm.

Given the comment you made about DSP techniques, how do you view the
shortfalls I mentioned in a previous post regarding Ehler's stuff?
i.e. the fact the algorithms have some big base-level assumptions in
them where Ehler assumes there is only one 'dominant' / tradeable
cycle at any one time...and his indicators are therefore prone to
noise and other cycles 'contaminating' the signal. It seems to me that
this is "assuming away" a problem rather than actually dealing with it
(a common engineering trick I believe).

As for who 'Bigged' you up, it wasn't me that called you a genius, it
was Rakesh!! :-)



--- In amibroker@xxxxxxxxxxxxxxx, "Fred" <ftonetti@xxx> wrote:
>
> Andy,
> 
> I would agree with all you said ... except for the comments about my 
> level of knowledge about cycles ... I'm hardly "Mr. Cycle" ... I 
> know somthing about how to search for cycle oriented info in a 
> sample and to some degree what to do with that information after I 
> found it ... nothing more ... nothing less ... 
> 
> I suspect the reason that my level of knowledge in this area isn't 
> higher is by nature I tend to be a system trader as opposed to a 
> discretionary trader.  Neither discipline is right or wrong but one 
> needs to understand where they themselves fit.  
> 
> I have always used longer term cyclic information as a backdrop to 
> describe what is likely to happen but IMHO use of cycles beyond that 
> typically falls more into the discretionary area then the system 
> area.  However, given the types of things we can do within AB and 
> the increase in my level of knowledge with regards to DSP in general 
> my attitude may change.
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "andy_davidson_uk1" 
> <AndyDavidson@> wrote:
> >
> > Rakesh,
> > 
> > The move was fine thanks, but as expected the settling in is taking
> > somewhat longer. Still don't have broadband connected, nor even a 
> desk
> > to sit at! Oh well, the laptop in front of the telly will have to 
> do
> > for now...
> > 
> > To try and answer your question, I think we must first bear in mind
> > that there are many ways to attempt to skin this cyclical beast. If
> > nothing else then this thread is showing that. First we had the FFT
> > discussion, then polynomials, then Ehler's DSP techniques and now
> > Hurst/Millard/Cleeton's methods.
> > 
> > There are, of course, benefits and drawbacks to each approach. I
> > touched on one problem I found with Ehler's stuff and Fred has 
> already
> > highlighted the problem with Hurst et al. Basically that, because 
> you
> > are using centred MAs as low-pass filters you don't have data up to
> > the right-edge and therefore have a zone of recent data within 
> which
> > you have to extrapolate the 'measured' cycles/envelopes. 
> > 
> > So how do you do this extrapolation to overcome the shortfall? 
> Well,
> > there are many ways, as we are seeing. I personally try and fit a 
> sine
> > wave to at least 2 'measured' cycles back and if there is good
> > correlation there and also good correlation in the "end zone" with 
> the
> > price then (i.e. prices are not moving opposite to the projected 
> sine
> > wave) then I get a little happier. There are probably better ways 
> to
> > extrapolate and I look forward to investigating them in the next 
> few
> > weeks/months. The good thing about the Cycle Highlighter though is
> > that you don't need to fit the amplitude so much as the
> > periodicity...i.e. I'm not looking for an absolute perfect sine-
> wave
> > fit to the price but more looking for a visual appreciation of the
> > market 'rhythm'.
> > 
> > So there's an answer to one of your questions...with this 
> indicator I
> > care much more about time/periodicity than I do about amplitude. 
> I'm
> > looking for it to help me decide *when* to get in, stay in or get 
> out.
> > I'm not looking for price targets here. See my comments re the GBP 
> in
> > the last post.
> > 
> > >>how do you interpret the correlation numbers? 
> > If the correlation coefficient is high and positive then I am 
> happy.
> > The higher the better!
> > 
> > >>What are you looking for when you say you wait for tradeable 
> cycles?
> > I don't necessarily wait for anything...more I go out looking for
> > things that are exhibiting clear cyclical behaviour and trade them,
> > passing over trades that I do not have a good degree of confidence 
> in.
> > It's more active than passive! :-)
> > 
> > >>please throw some light on the methodology you follow
> > 
> > Basically I reconcile myself to the limitation of the technique and
> > use a fair amount of discretion in my trading. I've learned that I 
> can
> > get superior results by trusting myself more and letting the 
> computer
> > become more of a visualising aid than a rule-generator. I have a 
> much
> > better relationship with my machine now that I've finally 
> convinced it
> > that my brain is superior at pattern recognition!!
> > 
> > Like I said, this is just one component of my trading method...each
> > component has its own drawbacks, the trick is to try to get the
> > relative strengths of one analysis to compensate for the 
> weaknesses in
> > another. Anyway, that's another story and I've talked enough 
> already.
> > But I will just say one thing more... 
> > 
> > >>"Fortunately for all interested Fred is taking an interest the
> > stuff, seems he is the resident genius on the subject"
> > 
> > I couldn't possibly disagree from what I've seen and heard, but 
> please
> > just bear in mind (warning - here comes a cliche!) that there is no
> > holy grail and at some point the Law of Diminishing Returns kicks 
> in
> > and you will better spend your time and energy just accepting some
> > basic assumptions/limitations and get on with the trading game. I 
> have
> > found that it's actually quite liberating (and financially 
> rewarding)
> > when you get to that place.
> > 
> > Good luck...hope that helps some.
> > 
> > Andy
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Rakesh Sahgal" <rakeshsahgal@>
> > wrote:
> > >
> > > Hi Andy
> > > 
> > > How is the moving and settling in getting along?
> > > 
> > > Fortunately for all  interested Fred is taking an interest the
> > stuff, seems
> > > he is the resident genius on the subject. Coming back to yuor 
> code
> > how do
> > > you interpret the correlation numbers? What are you looking for 
> when
> > you say
> > > you wait for tradeable cycles? Are you using criteria based on
> > > amplitude/phase or primarily cycle length? As and when you can 
> spare the
> > > time please throw some light on the methodology you follow. 
> Thanks,
> > > 
> > > Regards
> > > 
> > > 
> > > Rakesh
> > > 
> > > On 10/11/06, andy_davidson_uk1 <AndyDavidson@> wrote:
> > > >
> > > > 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 amibroker@xxxxxxxxxxxxxxx, "Rakesh Sahgal" 
> <rakeshsahgal@>
> > > > 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 <ftonetti@> 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
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>