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

[RT] Gen: Ehler Instantaneous Trend



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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>The attached&nbsp; .gif&nbsp; 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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>The&nbsp; .ela&nbsp; 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>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>Clyde</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>- - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;&nbsp; <BR>{&nbsp; <BR>Instantaneous 
Trend Line</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>This code was originally published in 
TAS&amp;C magazine, May, 2000.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>}<BR>Inputs:&nbsp;Price((H+L)/2),&nbsp;&nbsp;&nbsp; {price to be 
analyzed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Smooth(100),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&gt;0 = Percentage Multiplier 
of Period&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{&lt;0 = Use predicted trend based on difference 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{&nbsp;&nbsp;&nbsp;&nbsp; in past trend times this 
percentage&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp; 
&nbsp;&nbsp;&nbsp;SDLeng(0),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{Set non-zero for plot of SD bands per next&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;SDMult(2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{StdDev multiplier for upper/lower bands&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>Vars:&nbsp;&nbsp;InPhase(0),&nbsp;&nbsp;&nbsp;&nbsp;Quadrature(0),&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Phase(0),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DeltaPhase(0),<BR>&nbsp;&nbsp;&nbsp;&nbsp;count(0),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InstPeriod(0),&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Period(0),&nbsp;&nbsp;&nbsp;&nbsp;Trendline(Price),<BR>&nbsp;&nbsp;&nbsp;&nbsp;NewPrice(Price);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>Vars:&nbsp;SmoothFact(iff(Smooth&gt;0,Smooth*.01,1));</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><BR><FONT face="Courier New" size=2>If CurrentBar&gt;5 then 
begin&nbsp;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Compute InPhase and Quadrature 
components}<BR>&nbsp;Value1 = Price - Price[6];<BR>&nbsp;Value2 
=Value1[3];<BR>&nbsp;Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - 
Value1[4]);<BR>&nbsp;InPhase = .33*Value2 + .67*InPhase[1];<BR>&nbsp;Quadrature 
= .2*Value3 + .8*Quadrature[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Use ArcTangent to compute the 
current phase}<BR>&nbsp;If AbsValue(InPhase +InPhase[1]) &gt; 0 then Phase = 
ArcTangent(AbsValue((Quadrature+Quadrature[1]) / 
(InPhase+InPhase[1])));</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Resolve the ArcTangent 
ambiguity}<BR>&nbsp;If InPhase &lt; 0 and Quadrature &gt; 0 then Phase = 180 - 
Phase;<BR>&nbsp;If InPhase &lt; 0 and Quadrature &lt; 0 then Phase = 180 + 
Phase;<BR>&nbsp;If InPhase &gt; 0 and Quadrature &lt; 0 then Phase = 360 - 
Phase;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Compute a differential phase, 
resolve phase wraparound, and limit delta phase errors}<BR>&nbsp;DeltaPhase = 
Phase[1] - Phase;<BR>&nbsp;If Phase[1] &lt; 90 and Phase &gt; 270 then 
DeltaPhase = 360 + Phase[1] - Phase;<BR>&nbsp;If DeltaPhase &lt; 1 then 
DeltaPhase = 1;<BR>&nbsp;If DeltaPhase &gt; 60&nbsp; then Deltaphase = 
60;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Sum DeltaPhases to reach 360 
degrees.&nbsp; The sum is the instantaneous period.}<BR>&nbsp;InstPeriod = 
0;<BR>&nbsp;Value4 = 0;<BR>&nbsp;For count = 0 to 60 begin<BR>&nbsp;&nbsp;Value4 
= Value4 + DeltaPhase[count];<BR>&nbsp;&nbsp;If Value4 &gt; 360 and InstPeriod = 
0 then begin<BR>&nbsp;&nbsp;&nbsp;InstPeriod = 
count;<BR>&nbsp;&nbsp;end;<BR>&nbsp;end;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Resolve Instantaneous Period errors 
and smooth}<BR>&nbsp;If InstPeriod = 0 then InstPeriod = 
InstPeriod[1];<BR>&nbsp;Value5 = .25*(InstPeriod) + .75*Period[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;{Compute Trendline as simple average 
over the measured dominant cycle period}<BR>&nbsp;Period = 
IntPortion(Value5*SmoothFact);<BR>&nbsp;If Period&gt;MaxBarsBack-5 then 
Period=MaxBarsBack-5;<BR>&nbsp;Trendline = 0;<BR>&nbsp;For&nbsp; count = 0 to 
Period {+ 1} begin<BR>&nbsp;&nbsp;Trendline = Trendline + 
Price[count];<BR>&nbsp;end;<BR>&nbsp;If Period &gt; 0 then Trendline = Trendline 
/ (Period + 1{2});</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;NewPrice = .33*(Price + 
.5*(Price - Price[3])) + .67*NewPrice[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;if CurrentBar &lt; 26 then 
begin<BR>&nbsp;&nbsp;Trendline = Price;<BR>&nbsp;&nbsp;NewPrice = 
Price;<BR>&nbsp;End;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp; {if smooth is negative then use the 
negative of this value<BR>&nbsp; as a multiplier of the difference in prior data 
period<BR>&nbsp; length away to be an added to currenly computed 
trendline<BR>&nbsp; value}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp; If Smooth&lt;0 
then<BR>&nbsp;&nbsp;&nbsp; 
Value3=(Trendline-Trendline[Period])*-Smooth*.01<BR>&nbsp;Else<BR>&nbsp;&nbsp;Value3=0;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;<BR>&nbsp;Plot1(Trendline+Value3, 
"TR");<BR>&nbsp;If SDLeng&lt;&gt;0 then 
begin<BR>&nbsp;&nbsp;Value1=StdDev(c,SDLeng);<BR>&nbsp;&nbsp;Plot3(Trendline+Value1+Value3,"UP");<BR>&nbsp;&nbsp;Plot4(Trendline-Value1+Value3,"DN");<BR>&nbsp;End;<BR>&nbsp;Plot2(Price, 
"ZL");<BR>end;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>- - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - -<BR>Clyde Lee&nbsp;&nbsp; 
Chairman/CEO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Home of 
SwingMachine)<BR>SYTECH 
Corporation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
email:&nbsp;&nbsp; &lt;</FONT><A href="mailto:clydelee@xxxxxxx";><FONT 
face="Courier New" size=2>clydelee@xxxxxxx</FONT></A><FONT face="Courier New" 
size=2>&gt; <BR>7910 Westglen, Suite 105&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Work:&nbsp;&nbsp;&nbsp; (713) 783-9540<BR>Houston,&nbsp; TX&nbsp; 
77063&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Fax:&nbsp;&nbsp;&nbsp;&nbsp; (713) 783-1092&nbsp;&nbsp;&nbsp; <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>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>After joining list the freeware 
SwingMachine program <BR>(DOS Version) is available in the&nbsp; VAULT&nbsp; 
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"