Could this be what you are looking for:
Periods = 40; end = LinearReg( C, periods ); start = LinRegIntercept( C, periods ); slope = LinRegSlope( C, periods ); for( n = x = 0; n < periods; n++ ) x = x + abs( Ref( C, - n ) - ( end - n * slope ) ); Direction = end - start; Volatility = x; ER = Direction / Volatility; Plot( er, "er" , colorRed ); Filter = 1; AddColumn( er, "er" ); Regards Johan --- In [email protected], "timgadd" <[EMAIL PROTECTED]> 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? > ------------------------ Yahoo! Groups Sponsor --------------------~--> GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo. http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM --------------------------------------------------------------------~-> 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: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
