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

Re: Anybody have example cycle code



PureBytes Links

Trading Reference Links

Here's an oldie from my TS4 archive. If I remember correctly, it draws
something  similar to the TS cycle tool. Have fun.

Best,
Chris


input: begdate(741101), cyclen(10), invert(0), height(100);
{
This indicator plots a sine-type wave based on a known cycle length and
start date.
BEGDATE = starting cycle low or high;
CYCLEN = length in bars;
INVERT = 0 and spikes point down for cycle lows; invert <> 0 and spikes
point up for cycle highs
HEIGHT may be varied to make it easier to see multiple cycles plotted on
same chart window
}
 var: cyclow(0), cycday(0),cycval(0), daylen(0), counter(0);

if date >= begdate then begin
if date >= begdate and date[1] < begdate then cyclow = begdate;

value1 = minlist(1, counter/cyclen);
cycval = Sine(value1*180);
counter = counter + 1;

if value1 = 1  then counter = 1;
value2 = iff(invert=0,cycval,1-cycval);
plot1(height*value2,"cycle");

end;



----- Original Message ----- 
From: "John Corrion" <corrion@xxxxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Tuesday, September 27, 2005 6:47 PM
Subject: Anybody have example cycle code


> Hi,
>
> Does anybody have example cycle code that they can share?  Just drawing a
> sine wave on a chart or something like that.  I have been trying to
program
> and not successful.
>
> Thanks in advance,
>
> John
>