In his encyclopedic book, Trading Systems and Methods, Perry Kaufman introduces his efficiency ratio, ER, also called fractal efficiency. It is the absolute value of the price change over n periods divided by the sum of the absolute price change for each period. It has value of 1 when prices have moved in the same direction for each period. When prices move in opposite swings during the n periods the ER approaches zero. Kaufman uses the ER to calculate an adaptive moving average based on the trendiness of the market.Having a collection of monthly SIPro data disks I looked at a monthly ER based on monthly price moves over the last nine months. Thus my ER isABS(Price-Price M010)/[ABS(Price-Price M002)+ABS(Price M002-Price M003)+ .... +ABS(Price M009-Price M010)]In general, a final sort by 4wk return is unstable, sometimes mean-reverting and other times not. I looked at a 4wk sort for stocks with high ERs and low ERs to see if there was a predictive ability. In general, a low ER with a high 4-week sort made a good short screen, and a high ER with a 4-week sort made a decent long screen, albeit volatile.We thus have the makings of an ER hedge. The long screen isPrice > 5Price * Volume--Average Daily 10d > 500ADR/ADS Stock = FalseExchange <> Over the CounterIndustry <> 0721-Misc.FinancialServicesPrice M010 > 0Create [EffRatio]: ABS([SI Price]-[SI Price M010]) / (ABS([SI Price]-[SI Price M002]) + ABS([SI Price M002]-[SI Price M003]) + ABS([SI Price M003]-[SI Price M004]) + ABS([SI Price M004]-[SI Price M005]) + ABS([SI Price M005]-[SI Price M006]) + ABS([SI Price M006]-[SI Price M007]) + ABS([SI Price M007]-[SI Price M008]) + ABS([SI Price M008]-[SI Price M009]) + ABS([SI Price M009]-[SI Price M010]))EffRatio < 0.9EffRatio >= 0.7Sort Descending Price Change 4 weekAnd the short screen is the same except thatEffRatio < 0.2EffRatio >= 0The results for the long and short screens up to 2003 can be found in Keelix jobs 312341 and 312342. Early in 2003 the Keelix backtester switched to weekly data and a 4-week hold rather than monthly. Thus the dates began to drift and introduce a lag. The results from 2003 on are based on monthly data disks.So, how has the hedge performed over the last 14 years? Not bad, considering most hedges are lucky to yield a CAGR of 10%. (Well, actually any method that yields 10% a year has beaten the S&P500 by 6 percentage points and done quite well.)The results for a monthly hold of five long stocks and five short; the only disappointing year was 2006. Hedge S&P500CAGR 26% 4%GSD 27 20Ratio 0.96 0.20.1997 38% (4 months)1998 721999 182000 822001 382002 412003 272004 272005 702006 -242007 82008 - 32009 502010 - 22011 3For someone with facility with Robbie's GTR1 backtester, it would be very interesting to see this approach tested with daily data and different look-back periods.DB2
Hedge S&P500CAGR 26% 4%GSD 27 20Ratio 0.96 0.20.1997 38% (4 months)1998 721999 182000 822001 382002 412003 272004 272005 702006 -242007 82008 - 32009 502010 - 22011 3
what are the current stocks on this screen?
What are the current stocks on this screen?ER longLEDR NIHD GNMK CBB SPNCER shortUDRL VTNC ROSG ENOC HALODB2
In light of all the re-coding I've been doing lately, I can't say for certain whether I've torpedoed DrBob2's blend or his blend has torpedoed my backtester (or I've just misinterpreted something), but taking my backtester's results at face value, the blend seems pretty well sunk.The screens don't actually require any SI Pro data, so they can be tested from when Nasdaq started reporting daily volume in early 1983.I could have constructed a formula for Efficiency Ratio out of monthly g-prices using the functions gprc, abs and linear (and that may be a good way for a highly motivated user to check what I've done) the way DrBob2 did in RadiScript, but it was probably faster to just whip up a dedicated Efficiency Ratio function within the backtester itself. I've added the field function er, which takes three parameterizable arguments like the functions beta, xret, vol and gsd. The first is lag, the second is number of periods, and the third is the length of periods in market days.Here is my construction of the long screen:http://backtest.org/gtr1/2011/?aprc%281%29gt5:product%28av63...Translation:Create [ER]: [Efficiency Ratio of 21-day g-price changes over 10 periods; lag=1 days]step0: [Actual closing Price; share_lag=1 days; quote_lag=1 days] > 5step1: [[Actual Average daily Vol 63d; lag=1 days]*[Actual closing Price; share_lag=1 days; quote_lag=1 days]] > 500000step2: [Security Type] != 30,31,36step3: [Fama/French Industry Code] != 48step4: [mkt Days Since Investment Opened for purchase] > 210step5: [ER] >= 0.7step6: [ER] < 0.9step7: [Total Return Multiplier over 20 days; lag=1 days] Top 5; Long, Cash When FewerHolding period = 20 mkt days; Fully rebalance every 1 periodsstep2 eliminates ADRs and step3 eliminates the miscellaneous financial stocks.The screen to be shorted is this:http://backtest.org/gtr1/2011/?aprc%281%29gt5:product%28av63...Neither Keelix nor DrBob2 are explicit about the weighting of long, short and cash positions in blends, but I've assumed 1 part long, -1 part short and 2 parts cash in the blend:http://backtest.org/gtr1/2011/blend.cgi?-1:aprc(1)gt5:produc...The results for 19830131 through yesterday are as follows: Avg Min Max SD CAGR: 11.50 6.61 15.67 2.66 TR: 3017.96 564.79 7321.46 1972.49 GSD(20): 24.54 22.52 26.15 1.16 DD(20): 15.63 13.48 18.37 1.32 MDD: -54.87 -81.67 -43.50 10.39 UI(20): 19.14 10.97 35.91 5.65Sharpe(20): 0.42 0.22 0.59 0.11 Beta(20): -0.14 -0.24 -0.03 0.06 TI(20): -83.97 -342.36 -25.35 67.08 AT: 12.13 12.04 12.20 0.04I might as well reveal a new feature of the backtester: Putting -picks in the miscellaneous options box causes the backtester to run in screening mode, revealing the stock selections and all field values on the last market date of the backtest. Currently, only screens that do not use VL, VL+, SI Pro or WER data can reveal their screen selections, but conveniently, the screens above do not use any of this data. (All of the data that is currently displayed can be obtained from free sources online.) Here is a temporary direct link to the screening results for the long screen: http://backtest.org/gtr1/2011/csv/vmmnucstfo.csvThus, I encourage people to check my backtester's calculations of Efficiency Ratio and other price/volume-based metrics against what you come up with using your own data.Robbie GearyPS I'm working on a system for allowing VL, VL+ and SI Pro screening only for users who can prove they are subscribers by uploading the latest installation files. If the uploaded file matches what's on the server, then their browser gets a cookie that allows them to screen on that data until the next week's update. If there are any CGI Perl programmers who would like to help with this in the next week, send me an email.
Avg Min Max SD CAGR: 11.50 6.61 15.67 2.66 TR: 3017.96 564.79 7321.46 1972.49 GSD(20): 24.54 22.52 26.15 1.16 DD(20): 15.63 13.48 18.37 1.32 MDD: -54.87 -81.67 -43.50 10.39 UI(20): 19.14 10.97 35.91 5.65Sharpe(20): 0.42 0.22 0.59 0.11 Beta(20): -0.14 -0.24 -0.03 0.06 TI(20): -83.97 -342.36 -25.35 67.08 AT: 12.13 12.04 12.20 0.04
I tried the "-picks" command but get "The following lists all stocks eligible at step9, sorted in ascendingdescending order by field4, as of 20121003"even though the screen I used uses no fields. What, if anything, can I do to get the picks for the last step of a screen, by the criterion of such last step?
I tried the "-picks" command but get "The following lists all stocks eligible at step9, sorted in ascendingdescending order by field4, as of 20121003"even though the screen I used uses no fields. What, if anything, can I do to get the picks for the last step of a screen, by the criterion of such last step?Without a link, I can only guess what you were doing, but looking at the command logs, it sounds like what you ran produced one of these two results:http://backtest.org/gtr1/2011/csv/f5nsspi9rd.csvhttp://backtest.org/gtr1/2011/csv/lh2gpx0cin.csvIn both cases, you've used 8 fields (field0 through field7), with the final sort on field4, which is defined as tr(0,5). You defined 10 steps (step0 through step9). The list of 5,406 stocks that you see (in the second file) all passed the second to last step, step8, and they are sorted in ascending order (I've corrected the bug that produced that typo "ascendingdescending") by field 4, tr(0,5), in preparation for the last step, step9. If you're only interested in the bottom 5 by tr(0,5), then only look at the first 5 stocks in the list. But in case you were interested in more than 5, the backtester shows you everything that was eligible at the final step.Robbie Geary
thanks.I was confused by the use of the word "field" for "step".Great addition!
Best Of |
Favorites & Replies |
Start a New Board |
My Fool |