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

RE: Cycle Length



PureBytes Links

Trading Reference Links


> -----Original Message-----
> From: Chris Evans [mailto:evanscje@xxxxxxxxxxxxx]
> Sent: Thursday, January 08, 2004 6:58 AM
> To: Omega List; Gary Fritz
> Subject: Re: Cycle Length
>
>
> I'm sorry .. I meant to say that I want the sum of the price
> CHANGES to = 0 .. I tried this:
> Inputs:Price(numeric),Max(numericsimple);
>
> Vars:len(1),Min(1000),Save(10);

The key variable to initialize above is Save. To make the program easier
to understand, you might want to rename Min to Sum_Price_Chg, and Save to
Min.
Also in your original code you're incrementing Len inside a for loop that
is incrementing Len. This will cause you to skip all even cycle lengths.

Vars: Len(0), Sum_Price_Chg(0), Min(10000.0);

For Len = 5 to Max begin
  Min = Summation(Price-Price[1],len);
  If AbsValue(Sum_Price_Chg) < Min then begin
    Cyclelen = len;
    Min = Sum_Price_Chg;
  end;
end;

I think from a methodological point of view, you'll find that you may still
need to detrend the data to remove any persistant upward/downward bias.
Also, since you're summing different lengths, you run the likely risk that
this technique will always favor lower cycle lengths, because they will by
their nature have smaller sums (due to the fact that you're summing fewer
terms). I'd also try this algorithm, which always sums across 2*MAX data
points and see what gives the better result.

Vars: Len(0), Sum_Price_Chg(0), Min(10000.0);

For Len = 5 to Max begin
  Min = Summation(Price-Price[1],2*Max);
  If AbsValue(Sum_Price_Chg) < Min then begin
    Cyclelen = len;
    Min = Sum_Price_Chg;
  end;
end;

I think that from a signal processing point of view, you'd want to filter
out the very high frequencies (below 5) and the very low frequncies
(above 2*MAX, let's say) before running the cycle length determination
above.