Distance Coefficient Ehlers Filter
|
 |
|
|
|
Views:
1587 |
| Added: February 01, 2007 |
| |
| |
|
| This formula has not been rated yet |
|
|
| |
email this link
|
| |
| |
| Tags:
TradeStation, indicator
|
| |
 |
Here is some EasyLanguage code I developed to compute the filters presented in
my article in this issue, "Nonlinear Ehlers Filters."
Next is the EasyLanguage code to compute the distance coefficient Ehlers filter
also presented in my article in this issue, "Nonlinear Ehlers Filters":
The TradeStation code for a distance coefficient can also be used in the nonlinear
Ehlers filter. If you'd rather use a spreadsheet, an example of the TradeStation
code for a distance coefficient can be seen in Excel form in Figure 2.
FIGURE 2: DISTANCE COEFFICIENT. This spreadsheet computes the squared difference
between the current price and the price five bars back, and then squares it
to get a more responsive Ehlers filter value.
MICROSOFT EXCEL
To compute the filter in Excel, first compute the squared differences from
the current price as:
E7 = (D7-D6)^2+(D7-D5)^2+(D7-D4)^2+(D7-D3)^2+(D7-D2)^2
As soon as you have five values of the squared difference, compute, in F11:
F11 =D7*E7+D8*E8+D9*E9+D10*E10+D11*E11
Then,
G11 =SUM(E7:E11)
H11 =F11/G11
Copy all the row 11 values downward and check the values against those in Figure
2.
--John Ehlers
The EasyLanguage for both the function and indicator will be available for download
at www.tradestation.com. Look for the file "EhlersFilter.ELS."
-- Ramesh Dhingra, Product Manager, EasyLanguage
TradeStation Technologies, Inc. (formerly Omega Research, Inc.)
A wholly owned subsidiary of TradeStation Group, Inc.
http://www.TradeStation.com
Code:
Type : Indicator, Name : Distance Coefficient Ehlers Filter
<p>Inputs: Price((H+L)/2),<br>
Length(15); </p>
<p>Vars: count(0),<br>
LookBack(0),<br>
SumCoef(0),<br>
Num(0),<br>
Filt(0);</p>
<p>Array: Coef[25](0),<br>
Distance2[25](0);</p>
<p>For count = 0 to Length - 1 begin<br>
Distance2[count] = 0;<br>
For LookBack = 1 to Length begin<br>
Distance2[count] = Distance2[count] + (Price[count] - Price[count<br>
+ LookBack])*(Price[count] - Price[count + LookBack]);<br>
end;<br>
Coef[count] = Distance2[count];<br>
end;<br>
Num = 0;<br>
SumCoef =0;<br>
For count = 0 to Length -1 begin<br>
Num = Num + Coef[count]*Price[count];<br>
SumCoef = SumCoef + Coef[count];<br>
end;<br>
If SumCoef <> 0 then Filt = Num / SumCoef;</p>
<p>Plot1(Filt, "Ehlers");</p>
<p></p>
Author: John Ehlers
Source: http://www.traders.com
all formulas for TradeStation
all formulas
|