PureBytes Links
Trading Reference Links
|
Hi Graham,
Thanks for responding. My interpretation of your response is that it
identifies the first and last values of the efficiency ratio's (ER's)
denominator (the volatility part). What I am actually looking for,
and probably didn't explain very well, are the first and last values
of the numerator (the direction part). If I am misinterpreting your
response, please forgive my ignorance.
For my adaptation of the ER, I am looking for the y values of the
first and last points of a static (non-moving/straight) regression
line instead of the closing price at the beginning and the end of the
period.
Here's what I have started with ...
Filter = 1;
Periods = BarIndex() - BeginValue (BarIndex());
/* sets the start of the period with the BeginValue marker on the
chart and the end of period as the end of the chart (i think) */
Direction = LinearReg(Close,Periods) - BeginValue(LinearReg
(Close,Periods));
/* I want to substitute the end and beginning points on a static
linear regression line for the standard definition of Direction which
is the difference between the closing prices at the beginning and end
of the period = C - Ref(C, -periods). My code obviously does not
accomplish what I want because it returns the difference between the
values of 2 end points on a moving regression line */
Volatility = Sum(abs(C-LinearReg(C,Periods)), periods);
*/ What I want to do here is calculate the absolute value of each
closing price from each point on the static linear regression line
and sum the total as a substitute for the standard definition of
Volatility which = Sum(Abs(ROC(C,1), periods) */
ER = Direction / Volatility;
Maybe this explanation will better illustrate what I would like to do.
Tim
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> You can use lastvalue if you are testing to the last bar of the
chart,
> otherwise if you want to do this over a range within the chart
history
> you can use status to find the first and last values for that range
> for use in analysis window it will take the date range as used. I
have
> also added lastvalue so that it will always give these values even
> during the range
>
> first = lastvalue( valuewhen( status("firstbarinrange"), Sum(Abs(C -
> LinearReg(C, periods)), periods) ) );
> last = lastvalue( valuewhen( status("lastbarinrange"), Sum(Abs(C -
> LinearReg(C, periods)), periods) ) );
>
> if you want this in a chart then you can use the range markers
(mouse
> double click gives the lines with triangles at bottom) and
beginvalue
> and endvalue functions
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>
> On 4/15/06, timgadd <timgadd@xxx> wrote:
> > I'd like to employ a variation of Kaufman's Efficiency Ratio to
help
> > screen for stocks in tight rising channels. Specifically, I'd
like to
> > compare a stock's ROC weighted by it's Efficiency Ratio to that
of a
> > market index to screen out stocks that are outperforming the
index on
> > a volatiliy adjusted basis. (I realize there are other ways to
> > approach this, but I'd like to try this approach).
> >
> > The standard version of the Efficiency Ratio is defined as the
> > absolute value of direction over volatility where ...
> >
> > Direction = C - Ref(C, -periods);
> > Volatility = Sum(Abs(ROC(C,1), periods);
> >
> > I'd like, instead, to define Direction as the last (y) value of a
> > static (non-moving) linear regression line minus the first (y)
value
> > of the static linear regression line.
> >
> > I'd like to define Volatility as the "scatter" at each point along
> > the static linear regression line ... something like ...
> >
> > Sum(Abs(C - LinearReg(C, periods)), periods);
> >
> > ... except that this uses the moving linear regression
calculation.
> > I'd like to keep the start point of the regression line constant
so
> > that I can measure the efficiency ratio from a static reference
point
> > (a technical low).
> >
> > I've stumbled through some code for a static linear regression
line
> > (link below), but cannot figure our how to determine the beginning
> > and ending points.
> >
> > http://www.amibroker.com/library/detail.php?
id=193&hilite=LASTVALUE
> >
> > Any suggestions?
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|