PureBytes Links
Trading Reference Links
|
<x-html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4030.2400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2>I'm still working with the Ehler
thing.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I wanted to see how good it was on
theoretical data in which</FONT></DIV>
<DIV><FONT face="Courier New" size=2>there was a dominant long wave and the
short interval</FONT></DIV>
<DIV><FONT face="Courier New" size=2>cycle on which Ehler can work.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I built a non-trending data set composed of
a 180 period</FONT></DIV>
<DIV><FONT face="Courier New" size=2>sine wave with an amplitude of 7 plus a
constant of 14 and</FONT></DIV>
<DIV><FONT face="Courier New" size=2>a 22 period sine wave with amplitude of
2.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The attached .gif shows the
picture of the TRUE trend</FONT></DIV>
<DIV><FONT face="Courier New" size=2>which is comuted with a CENTERED moving
average of</FONT></DIV>
<DIV><FONT face="Courier New" size=2>length 22 -- filters out the 22 period junk
-- IN BLUE.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The red line takes the PERIOD which Ehler
computes and</FONT></DIV>
<DIV><FONT face="Courier New" size=2>then determines the phase and amplitude of
the data</FONT></DIV>
<DIV><FONT face="Courier New" size=2>with that period and subtracts this
estimate from the data.</FONT></DIV>
<DIV><FONT face="Courier New" size=2>If the estimates of period length and
period phase and</FONT></DIV>
<DIV><FONT face="Courier New" size=2>amplitude were correct then we would get
the same as</FONT></DIV>
<DIV><FONT face="Courier New" size=2>the blue line IN REAL TIME -- NOT DELAYED
but as you</FONT></DIV>
<DIV><FONT face="Courier New" size=2>will note it ain't quite so but
"close".</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Another method to try to reduce lag is to
use prior data</FONT></DIV>
<DIV><FONT face="Courier New" size=2>and estimate the real value of data
today.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The black line does this and when in the
trend the lag</FONT></DIV>
<DIV><FONT face="Courier New" size=2>IS REDUCED but not much at the
turns.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The .ela will allow you to
experiment with the prediction</FONT></DIV>
<DIV><FONT face="Courier New" size=2>concept!!!!</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Clyde</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> <BR>{ <BR>Instantaneous
Trend Line</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Ehlers uses a two-mode market model:
trending or cycling. By removing the<BR>dominant cycle from the price data, the
remaining information is mostly<BR>about trend. Here is the EasyLanguage Code to
plot Instantaneous Trend Line</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>This code was originally published in
TAS&C magazine, May, 2000.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Modifications to allow prediction and
smoothing of period computed are by<BR>Clyde Lee, April, 2000.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2>}<BR>Inputs: Price((H+L)/2), {price to be
analyzed
}<BR>
Smooth(100), {>0 = Percentage Multiplier
of Period
}<BR>
{<0 = Use predicted trend based on difference
}<BR>
{ in past trend times this
percentage }<BR>
SDLeng(0),
{Set non-zero for plot of SD bands per next
}<BR> SDMult(2);
{StdDev multiplier for upper/lower bands
}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2>Vars: InPhase(0), Quadrature(0), <BR> Phase(0), DeltaPhase(0),<BR> count(0), InstPeriod(0), <BR> Period(0), Trendline(Price),<BR> NewPrice(Price);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2>Vars: SmoothFact(iff(Smooth>0,Smooth*.01,1));</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><BR><FONT face="Courier New" size=2>If CurrentBar>5 then
begin </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Compute InPhase and Quadrature
components}<BR> Value1 = Price - Price[6];<BR> Value2
=Value1[3];<BR> Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] -
Value1[4]);<BR> InPhase = .33*Value2 + .67*InPhase[1];<BR> Quadrature
= .2*Value3 + .8*Quadrature[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Use ArcTangent to compute the
current phase}<BR> If AbsValue(InPhase +InPhase[1]) > 0 then Phase =
ArcTangent(AbsValue((Quadrature+Quadrature[1]) /
(InPhase+InPhase[1])));</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Resolve the ArcTangent
ambiguity}<BR> If InPhase < 0 and Quadrature > 0 then Phase = 180 -
Phase;<BR> If InPhase < 0 and Quadrature < 0 then Phase = 180 +
Phase;<BR> If InPhase > 0 and Quadrature < 0 then Phase = 360 -
Phase;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Compute a differential phase,
resolve phase wraparound, and limit delta phase errors}<BR> DeltaPhase =
Phase[1] - Phase;<BR> If Phase[1] < 90 and Phase > 270 then
DeltaPhase = 360 + Phase[1] - Phase;<BR> If DeltaPhase < 1 then
DeltaPhase = 1;<BR> If DeltaPhase > 60 then Deltaphase =
60;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Sum DeltaPhases to reach 360
degrees. The sum is the instantaneous period.}<BR> InstPeriod =
0;<BR> Value4 = 0;<BR> For count = 0 to 60 begin<BR> Value4
= Value4 + DeltaPhase[count];<BR> If Value4 > 360 and InstPeriod =
0 then begin<BR> InstPeriod =
count;<BR> end;<BR> end;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Resolve Instantaneous Period errors
and smooth}<BR> If InstPeriod = 0 then InstPeriod =
InstPeriod[1];<BR> Value5 = .25*(InstPeriod) + .75*Period[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {Compute Trendline as simple average
over the measured dominant cycle period}<BR> Period =
IntPortion(Value5*SmoothFact);<BR> If Period>MaxBarsBack-5 then
Period=MaxBarsBack-5;<BR> Trendline = 0;<BR> For count = 0 to
Period {+ 1} begin<BR> Trendline = Trendline +
Price[count];<BR> end;<BR> If Period > 0 then Trendline = Trendline
/ (Period + 1{2});</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> NewPrice = .33*(Price +
.5*(Price - Price[3])) + .67*NewPrice[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> if CurrentBar < 26 then
begin<BR> Trendline = Price;<BR> NewPrice =
Price;<BR> End;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> {if smooth is negative then use the
negative of this value<BR> as a multiplier of the difference in prior data
period<BR> length away to be an added to currenly computed
trendline<BR> value}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> If Smooth<0
then<BR>
Value3=(Trendline-Trendline[Period])*-Smooth*.01<BR> Else<BR> Value3=0;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> <BR> Plot1(Trendline+Value3,
"TR");<BR> If SDLeng<>0 then
begin<BR> Value1=StdDev(c,SDLeng);<BR> Plot3(Trendline+Value1+Value3,"UP");<BR> Plot4(Trendline-Value1+Value3,"DN");<BR> End;<BR> Plot2(Price,
"ZL");<BR>end;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -<BR>Clyde Lee
Chairman/CEO (Home of
SwingMachine)<BR>SYTECH
Corporation
email: <</FONT><A href="mailto:clydelee@xxxxxxx"><FONT
face="Courier New" size=2>clydelee@xxxxxxx</FONT></A><FONT face="Courier New"
size=2>> <BR>7910 Westglen, Suite 105
Work: (713) 783-9540<BR>Houston, TX
77063
Fax: (713) 783-1092 <BR>- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -<BR>- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -<BR>To subscribe / unsubscribe from SwingMachine
list<BR></FONT><A href="http://www.egroups.com/list/swingmachine/"><FONT
face="Courier New"
size=2>http://www.egroups.com/list/swingmachine/</FONT></A></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>After joining list the freeware
SwingMachine program <BR>(DOS Version) is available in the VAULT
at:<BR></FONT><A href="http://www.egroups.com/list/swingmachine/"><FONT
face="Courier New"
size=2>http://www.egroups.com/list/swingmachine/</FONT></A><BR><FONT
face="Courier New" size=2>- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -<BR></FONT></DIV></BODY></HTML>
</x-html>
Attachment Converted: "f:\eudora\attach\junk118.gif"
Attachment Converted: "f:\eudora\attach\EHLINSTT1.ELA"
|