PureBytes Links
Trading Reference Links
|
<x-html><HTML>
<BODY TEXT="#000000" BGCOLOR="#FFFFCC" LINK="#0000EE" VLINK="#00FF00" ALINK="#FF0000">
<TT>Traders,</TT><TT></TT>
<P><TT>I use cycles quite a bit in my trading. I'm attaching</TT>
<BR><TT>an .ela file which implements the basic ideas which</TT>
<BR><TT>are used in a number of ways in my work.</TT><TT></TT>
<P><TT>There are two indicators:</TT>
<BR><TT> FourLine and FourPeriod.</TT><TT></TT>
<P><TT> Fourline plots the fourier spectral lines from
3 to 120</TT>
<BR><TT> periods from data taken from the specified input
time zone.</TT><TT></TT>
<P><TT> FourPeriod plots the length of the maximum peak
of the</TT>
<BR><TT> fourier line over the selected range of periods.
This is</TT>
<BR><TT> done for every nth days (n=1...m) in the data
set.</TT><TT></TT>
<P><TT>What follows is the actual EL code for those who do
not</TT>
<BR><TT>have TradeStation.</TT><TT></TT>
<P><TT>I hope it helps you evaluate "lenght of period" involved in</TT>
<BR><TT>functions that are length sensitive.</TT><TT></TT>
<P><TT>{</TT>
<BR><TT> Function: FourLine</TT><TT></TT>
<P><TT> Purpose: Calculate the Fourier amplitude and phase</TT>
<BR><TT> values at a selected price over a given</TT>
<BR><TT> period of time.</TT>
<BR><TT></TT> <TT></TT>
<P><TT> Author: Clyde Lee, SYTECH/Futuresmagic.</TT>
<BR><TT> Copyright: Clyde Lee, 1998.</TT><TT></TT>
<P><TT> This is a conversion of a ProfessionalBasic routine that</TT>
<BR><TT> is used in SwingMachine software to perform and display</TT>
<BR><TT> Fourier analyses and projections.</TT>
<BR><TT></TT> <TT></TT>
<P><TT>SUB FOURLINE (PRICES!(), PERIOD!, TMIN, TMAX, PEAKA!, RADS!)</TT><TT></TT>
<P><TT>Returns the amplitude OR phase of the wave of specified</TT>
<BR><TT>period in the form AAAAA.ppp</TT><TT></TT>
<P><TT> where: AAAAA = amplitude for wave in</TT>
<BR><TT> same
units as input prices</TT>
<BR><TT> PPP = phase (in
radians).</TT><TT></TT>
<P><TT>Basic concepts from work of Singleton & John Ehlers. Singleton</TT>
<BR><TT>first published the method in the late 1960's and Ehler has seen</TT>
<BR><TT>fit to use these methods in published works.</TT><TT></TT>
<P><TT>After conversion returns either amplitude or phase in degrees.</TT>
<BR><TT>Set input variable DoPhas to true to get phase data
or to</TT>
<BR><TT>false to get amplitude value.</TT><TT></TT>
<P><TT>}</TT>
<BR><TT>INPUTS: Price(numericseries), {Price on which to compute}</TT>
<BR><TT> Period(numericsimple), {Period of wave for analysis}</TT>
<BR><TT> NumBars(numericsimple), {number of bars to use
in computation}</TT>
<BR><TT> DoPhas(truefalse); {false=do ampl, true=do
phase}</TT><TT></TT>
<P><TT>VARS: PeakA(0),Degs(0);</TT>
<BR><TT>VARS: AF(0),XF(0),YF(0),GF(0),EF(0),</TT>
<BR><TT> Indx(0);</TT>
<BR><TT> </TT>
<BR><TT> AF = 360 / Period;</TT>
<BR><TT> XF = Cosine(AF); YF = Sine(AF);</TT>
<BR><TT> GF = 0; EF = Price[0];</TT><TT></TT>
<P><TT> FOR Indx = 1 to NumBars-1 BEGIN</TT>
<BR><TT> AF = EF;</TT>
<BR><TT> EF = AF * XF - GF * YF + Price[Indx];</TT>
<BR><TT> GF = AF * YF + GF * XF;</TT>
<BR><TT> END;</TT>
<BR><TT> EF = (EF + EF) / NumBars; GF = (GF + GF) / NumBars;</TT>
<BR><TT> PeakA = SquareRoot(EF * EF + GF * GF);</TT><TT></TT>
<P><TT> IF EF=0 THEN Degs=0 ELSE Degs=Arctangent(GF/EF) ;</TT>
<BR><TT> IF GF>0 THEN VALUE1=1 ELSE VALUE1=-1;</TT>
<BR><TT> IF 0>EF THEN VALUE2=1 ELSE VALUE2=-1;</TT>
<BR><TT> Degs = Degs + (VALUE1 * VALUE2 * 180);</TT>
<BR><TT> WHILE Degs > 360 BEGIN</TT>
<BR><TT> Degs = Degs - 360;</TT>
<BR><TT> END;</TT>
<BR><TT> WHILE Degs < 0 BEGIN</TT>
<BR><TT> Degs = Degs + 360;</TT>
<BR><TT> END;</TT>
<BR><TT> </TT>
<BR><TT>If DoPhas THEN FourLine = Degs</TT>
<BR><TT>ELSE FourLine=PeakA;</TT>
<BR><TT></TT> <TT></TT>
<P><TT>* * * * * * * * * * * * * * * * * * * * * * * * * * * *</TT><TT></TT>
<P><TT>{</TT>
<BR><TT> Function: FourPeriod</TT><TT></TT>
<P><TT> Purpose: (1) Calculate the spectral lines beginning
with</TT>
<BR><TT> the input BegPer and
ending with input EndPer</TT>
<BR><TT> over a the closing price data set ending
with</TT>
<BR><TT> the current close and extending back in
time for</TT>
<BR><TT> a period equal to 4 times the analysis
being</TT>
<BR><TT> performed.</TT>
<BR><TT> </TT>
<BR><TT> (2) Pick the largest peak value encountered</TT>
<BR><TT> [note I said PEAK] in the range of periods
that</TT>
<BR><TT> are specified for analysis and return
the period</TT>
<BR><TT> value (period not amplitude) at which
this</TT>
<BR><TT> maximum peak amplitude is found.</TT>
<BR><TT></TT> <TT></TT>
<P><TT> Author: Clyde Lee, SYTECH/Futuresmagic.</TT>
<BR><TT> Copyright: Clyde Lee, 1998.</TT>
<BR><TT></TT>
<BR><TT></TT> <TT></TT>
<P><TT>}</TT><TT></TT>
<P><TT>Input: BegPer (NumericSimple),</TT>
<BR><TT> EndPer (NumericSimple);</TT><TT></TT>
<P><TT>Var: BegAnl(EndPer*4);</TT><TT></TT>
<P><TT>If Currentbar>BegAnl then begin</TT>
<BR><TT> Value6=0;Value7=0;</TT>
<BR><TT> For Value1=EndPer downto BegPer begin</TT>
<BR><TT> VALUE3 = fourline(c,Value1,Value1*4,FALSE);</TT>
<BR><TT> {print (date,"v1..=",Value1,Value3,Value4,Value5,Value6,Value7);}</TT>
<BR><TT> If Value1<EndPer-1 then begin</TT>
<BR><TT> if Value3<=Value4 and Value4>=Value5 then begin</TT>
<BR><TT> If Value4>Value6 then begin</TT>
<BR><TT> Value6=Value4;</TT>
<BR><TT> Value7=Value1+1;</TT>
<BR><TT> End;</TT>
<BR><TT> end;</TT>
<BR><TT> End;</TT>
<BR><TT> Value5=Value4;Value4=Value3;</TT>
<BR><TT> End;</TT>
<BR><TT> FourPeriod = Value7;</TT>
<BR><TT>End</TT>
<BR><TT>Else FourPeriod = 0;</TT>
<BR><TT></TT> <TT></TT>
<P><TT>* * * * * * * * * * * * * * * * * * * * * * * * * * * *</TT><TT></TT>
<P><TT>{</TT>
<BR><TT> Indicator: FourLine</TT><TT></TT>
<P><TT> Purpose: Plot a "line spectra" of the closing price
data</TT>
<BR><TT> in the range BegDate
and EndDate.</TT><TT></TT>
<P><TT> Also plots a ramp indicating the frequency
of</TT>
<BR><TT> each line.</TT>
<BR><TT> </TT>
<BR><TT> By activating the DataWindow and
setting it</TT>
<BR><TT> to display one line of data (put at top
of chart)</TT>
<BR><TT> then by clicking on a line showing a peak
you</TT>
<BR><TT> can read the peak amplitude (*10) and
the period</TT>
<BR><TT> of that peak.</TT><TT></TT>
<P><TT> Author: Clyde Lee, SYTECH/Futuresmagic.</TT>
<BR><TT> Copyright: Clyde Lee, 1998.</TT>
<BR><TT></TT> <TT></TT>
<P><TT>}</TT>
<BR><TT></TT> <TT></TT>
<P><TT>Input: BegDate(650101),EndDate(991231);</TT>
<BR><TT>Var: begbar(0),endbar(0);</TT><TT></TT>
<P><TT>if date<=begdate then begbar=currentbar;</TT>
<BR><TT>if date<=enddate then endbar=currentbar;</TT><TT></TT>
<P><TT>if LastBarOnChart=true then begin</TT>
<BR><TT> Value4=IntPortion((endbar-begbar)/4); {LengAnl;}</TT>
<BR><TT> if Value4>120 then Value4=120;</TT>
<BR><TT> For Value1 = Value4 downto 3 begin</TT>
<BR><TT> VALUE3 = fourline(c[currentbar-endbar],VALUE1,Value1*4,FALSE);</TT>
<BR><TT> PLOT3[currentbar-endbar+Value4-VALUE1](Value3*10,"Ampl");</TT>
<BR><TT> plot2[currentbar-endbar+Value4-Value1](value1,"Freq");</TT>
<BR><TT> End;</TT>
<BR><TT>End;</TT><TT></TT>
<P><TT>* * * * * * * * * * * * * * * * * * * * * * * * * * * *</TT><TT></TT>
<P><TT>{</TT>
<BR><TT> Indicatior: FourPeriod</TT>
<BR><TT> Purpose: Plot the PERIOD value at which the peak amplitude</TT>
<BR><TT> spectral value was found in the periods
begper+1</TT>
<BR><TT> to endper-1.</TT>
<BR><TT> </TT>
<BR><TT> An interval (in number of bars) between
each of</TT>
<BR><TT> these analysis can be specified to speed
up the</TT>
<BR><TT> process.</TT><TT></TT>
<P><TT> Author: Clyde Lee, SYTECH/Futuresmagic.</TT>
<BR><TT> Copyright: Clyde Lee, 1998.</TT><TT></TT>
<P><TT>}</TT>
<BR><TT></TT> <TT></TT>
<P><TT>Input: BegPer(15),EndPer(25),Interval(5);</TT>
<BR><TT>Var: Begbar(0),endbar(0);</TT><TT></TT>
<P><TT>If Mod(Currentbar,Interval)=0 then begin</TT>
<BR><TT> Value3 = FourPeriod(BegPer,EndPer);</TT>
<BR><TT> PLOT3 (Value3,"PerL");</TT>
<BR><TT>END;</TT><TT></TT>
<P><TT>* * * * * * * * * * * * * * * * * * * * * * * * * * * *</TT>
<BR><TT></TT> <TT></TT>
<P><TT>Chris Jackson wrote:</TT>
<BLOCKQUOTE TYPE=CITE><TT>Snipped</TT><TT></TT>
<P><TT> What I've been doing is using an</TT>
<BR><TT>> easylanguage MRO function to find the highest high [20] and the
--</TT></BLOCKQUOTE>
<TT>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</TT>
<BR><TT>Clyde Lee Chairman/CEO
(Home of SwingMacine)</TT>
<BR><TT>SYTECH Corporation
email: <clydelee@xxxxxxx></TT>
<BR><TT>7910 Westglen, Suite 105
Work: (713) 783-9540</TT>
<BR><TT>Houston, TX 77063
Fax: (713) 783-1092</TT>
<BR><TT>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</TT>
<BR><TT> </TT>
</BODY>
</HTML>
</x-html>
Attachment Converted: "c:\eudora\attach\Fourmisc.ela"
Attachment Converted: "c:\eudora\attach\FourMisc.gif"
|