StockFetcher Forums · Filter Exchange · Sharpe Allocation Filter - 11 ETS Want to Add Two More | << >>Post Follow-up |
davesaint86 725 posts msg #134280 - Ignore davesaint86 modified |
2/14/2017 11:25:23 AM I was able to modify Kevin's original filter and add some more funds to it. I would like to add two more funds to it but keep screwing something up. Any help would be appreciated. By the way for longer term trading this is a decent filter and is underrated. Fetcher[ symlist(iws,xly,xlp,xle,xlf,xlv,xli,xlb,xlre,xlk,xlu) SET{perf1A, ma(3) 60 days ago} SET{perf1b, MA(3) / perf1a} SET{perf, perf1b - 1} SET{var1, perf*100} SET{rfr, ind(^irx,close)} SET{RISKFREERETURN, rfr/100} SET{perf63, perf - RISKFREERETURN} SET{STD63, CSTDDEV(CLOSE,63)} SET{VOL63a, STD63 / MA(63)} SET{vol63, vol63a * 100} /*CALCULATION OF SHARPE RATIO - ANNUALIZED*/ SET{SHARPE1a, perf63 / VOL63a} set{sharpe, sharpe1a * 0.5} set{var1a, IND(iws, var1)} set{var1b, IND(xly, var1)} set{var1c, IND(xlp, var1)} set{var1d, IND(xle, var1)} set{var1e, IND(xlf, var1)} set{var1f, IND(xlv, var1)} set{var1g, IND(xli, var1)} set{var1h, IND(xlb, var1)} set{var1i, IND(xlre, var1)} set{var1j, IND(xlk, var1)} set{var1k, IND(xlu, var1)} SET{RANK1A, COUNT(var1 is above var1a,1)} SET{RANK1B, COUNT(var1 is above var1b,1)} SET{RANK1C, COUNT(var1 is above var1c,1)} SET{RANK1D, COUNT(var1 is above var1d,1)} SET{RANK1E, COUNT(var1 is above var1e,1)} SET{RANK1F, COUNT(var1 is above var1f,1)} SET{RANK1G, COUNT(var1 is above var1g,1)} SET{RANK1H, COUNT(var1 is above var1h,1)} SET{RANK1I, COUNT(var1 is above var1i,1)} SET{RANK1J, COUNT(var1 is above var1j,1)} SET{RANK1K, COUNT(var1 is above var1k,1)} SET{RANK1L, RANK1A + RANK1B} SET{RANK1M, RANK1C + RANK1D} SET{RANK1N, RANK1E + RANK1F} SET{RANK1O, RANK1G + RANK1H} SET{RANK1P, RANK1I + RANK1J} SET{RANK1Q, RANK1K + RANK1L} SET{RANK1R, RANK1M + RANK1N} SET{RANK1S, RANK1O + RANK1P} SET{RANK1T, RANK1Q + RANK1R} SET{RANK1U, RANK1S + RANK1T} SET{RANK, 11 - RANK1U} set{var2a, IND(iws, sharpe)} set{var2b, IND(xly, sharpe)} set{var2c, IND(xlp, sharpe)} set{var2d, IND(xle, sharpe)} set{var2e, IND(xlf, sharpe)} set{var2f, IND(xlv, sharpe)} set{var2g, IND(xli, sharpe)} set{var2h, IND(xlb, sharpe)} set{var2i, IND(xlre, sharpe)} set{var2j, IND(xlk, sharpe)} set{var2k, IND(xlu, sharpe)} SET{var3a, COUNT(var2a is above 0,1)} SET{var3b, COUNT(var2b is above 0,1)} SET{var3c, COUNT(var2c is above 0,1)} SET{var3d, COUNT(var2d is above 0,1)} SET{var3e, COUNT(var2e is above 0,1)} SET{var3f, COUNT(var2f is above 0,1)} SET{var3g, COUNT(var2g is above 0,1)} SET{var3h, COUNT(var2h is above 0,1)} SET{var3i, COUNT(var2i is above 0,1)} SET{var3j, COUNT(var2j is above 0,1)} SET{var3k, COUNT(var2k is above 0,1)} SET{var4a, var2a * var3a} SET{var4b, var2b * var3b} SET{var4c, var2c * var3c} SET{var4d, var2d * var3d} SET{var4e, var2e * var3e} SET{var4f, var2f * var3f} SET{var4g, var2g * var3g} SET{var4h, var2h * var3h} SET{var4i, var2i * var3i} SET{var4j, var2j * var3j} SET{var4k, var2k * var3k} set{var5a, var4a + var4b} set{var5b, var4c + var4d} set{var5c, var4e + var4f} set{var5d, var4g + var4h} set{var5e, var4i + var4j} set{var5f, var4k} set{var5g, var5a + var5b} set{var5h, var5c + var5d} set{var5i, var5e + var5f} set{var5j, var5g + var5h} set{var5k, var5j + var5i} SET{allocation1, sharpe / var5k} set{allocation2, allocation1 * count(sharpe above 0,1)} set{allocation, allocation2 *100} SET{TI42, MA(4) / MA(42)} ADD COLUMN SEPARATOR ADD COLUMN RANK {Rank} ADD COLUMN SEPARATOR ADD COLUMN TI42 DD COLUMN SEPARATOR add column atr(21) {Atr$} add column separator add column average day range (21){ADR%} ADD COLUMN SEPARATOR ADD COLUMN ROC(126,1) {6 mth %} add column separator ADD COLUMN ROC(63,1) {3 mth %} add column separator ADD COLUMN ROC(21,1) {1 mth %} add column separator ADD COLUMN vol63 {vol(%)} add column separator add column sharpe {sharpe ratio} add column separator add column allocation {Allocation (%)} add column separator add column corr(spy,63, close) {S&P500 Cor.} add column separator add column RSI(9) add column separator add column RSI(30) add column separator add column WEEKLY IFT(2,1){IFT} add column separator add column MA(200) and draw CCI (20) line at 100.00 and draw CCI (20) line at 50 and draw CCI (20) line at 10 and draw Slow Stochastic(5,1) Fast %K line at 20.00 and draw Slow Stochastic(5,1) Fast %K line at 80.00 and draw Slow Stochastic(5,1) Fast %K line at 50.00 and draw MACD Fast Line(12,26) line at 0 and draw RSI(30) line at 50 and Draw RSI(9) on plot RSI(30) DRAW WEEKLY IFT(2,1) DRAW WEEKLY IFT(2,1) LINE AT .90 DRAW WEEKLY IFT(2,1) LINE AT -.90 DRAW WEEKLY IFT(2,1) LINE AT 0 SORT ON COLUMN 6 ascending CHART-TIME IS 120 days draw MA(3) draw sharpe line at 0 ] |
SAFeTRADE 644 posts msg #134281 - Ignore SAFeTRADE |
2/14/2017 11:41:27 AM I think this what you are looking for. Fetcher [ symlist(iws,xly,xlp,xle,xlf,xlv,xli,xlb,xlre,xlk,xlu) SET{perf1A, ma(3) 60 days ago} SET{perf1b, MA(3) / perf1a} SET{perf, perf1b - 1} SET{var1, perf*100} SET{rfr, ind(^irx,close)} SET{RISKFREERETURN, rfr/100} SET{perf63, perf - RISKFREERETURN} SET{STD63, CSTDDEV(CLOSE,63)} SET{VOL63a, STD63 / MA(63)} SET{vol63, vol63a * 100} /*CALCULATION OF SHARPE RATIO - ANNUALIZED*/ SET{SHARPE1a, perf63 / VOL63a} set{sharpe, sharpe1a * 0.5} set{var1a, IND(iws, sharpe)} set{var1b, IND(xly, sharpe)} set{var1c, IND(xlp, sharpe)} set{var1d, IND(xle, sharpe)} set{var1e, IND(xlf, sharpe)} set{var1f, IND(xlv, sharpe)} set{var1g, IND(xli, sharpe)} set{var1h, IND(xlb, sharpe)} set{var1i, IND(xlre, sharpe)} set{var1j, IND(xlk, sharpe)} set{var1k, IND(xlu,sharpe)} SET{RANK1A, COUNT(sharpe is above var1a,1)} SET{RANK1B, COUNT(sharpe is above var1b,1)} SET{RANK1C, COUNT(sharpe is above var1c,1)} SET{RANK1D, COUNT(sharpe is above var1d,1)} SET{RANK1E, COUNT(sharpe is above var1e,1)} SET{RANK1F, COUNT(sharpe is above var1f,1)} SET{RANK1G, COUNT(sharpe is above var1g,1)} SET{RANK1H, COUNT(sharpe is above var1h,1)} SET{RANK1I, COUNT(sharpe is above var1i,1)} SET{RANK1J, COUNT(sharpe is above var1j,1)} SET{RANK1K, COUNT(sharpe is above var1k,1)} SET{RANK1L, RANK1A + RANK1B} SET{RANK1M, RANK1C + RANK1D} SET{RANK1N, RANK1E + RANK1F} SET{RANK1O, RANK1G + RANK1H} SET{RANK1P, RANK1I + RANK1J} SET{RANK1Q, RANK1K + RANK1L} SET{RANK1R, RANK1M + RANK1N} SET{RANK1S, RANK1O + RANK1P} SET{RANK1T, RANK1Q + RANK1R} SET{RANK1U, RANK1S + RANK1T} SET{RANK, 11 - RANK1U} set{var2a, IND(iws, sharpe)} set{var2b, IND(xly, sharpe)} set{var2c, IND(xlp, sharpe)} set{var2d, IND(xle, sharpe)} set{var2e, IND(xlf, sharpe)} set{var2f, IND(xlv, sharpe)} set{var2g, IND(xli, sharpe)} set{var2h, IND(xlb, sharpe)} set{var2i, IND(xlre, sharpe)} set{var2j, IND(xlk, sharpe)} set{var2k, IND(xlu, sharpe)} SET{var3a, COUNT(var2a is above 0,1)} SET{var3b, COUNT(var2b is above 0,1)} SET{var3c, COUNT(var2c is above 0,1)} SET{var3d, COUNT(var2d is above 0,1)} SET{var3e, COUNT(var2e is above 0,1)} SET{var3f, COUNT(var2f is above 0,1)} SET{var3g, COUNT(var2g is above 0,1)} SET{var3h, COUNT(var2h is above 0,1)} SET{var3i, COUNT(var2i is above 0,1)} SET{var3j, COUNT(var2j is above 0,1)} SET{var3k, COUNT(var2k is above 0,1)} SET{var4a, var2a * var3a} SET{var4b, var2b * var3b} SET{var4c, var2c * var3c} SET{var4d, var2d * var3d} SET{var4e, var2e * var3e} SET{var4f, var2f * var3f} SET{var4g, var2g * var3g} SET{var4h, var2h * var3h} SET{var4i, var2i * var3i} SET{var4j, var2j * var3j} SET{var4k, var2k * var3k} set{var5a, var4a + var4b} set{var5b, var4c + var4d} set{var5c, var4e + var4f} set{var5d, var4g + var4h} set{var5e, var4i + var4j} set{var5f, var4k} set{var5g, var5a + var5b} set{var5h, var5c + var5d} set{var5i, var5e + var5f} set{var5j, var5g + var5h} set{var5k, var5j + var5i} SET{allocation1, sharpe / var5k} set{allocation2, allocation1 * count(sharpe above 0,1)} set{allocation, allocation2 *100} SET{TI42, MA(4) / MA(42)} ADD COLUMN SEPARATOR ADD COLUMN RANK {Rank} ADD COLUMN SEPARATOR ADD COLUMN TI42 DD COLUMN SEPARATOR add column atr(21) {Atr$} add column separator add column average day range (21){ADR%} ADD COLUMN SEPARATOR ADD COLUMN ROC(126,1) {6 mth %} add column separator ADD COLUMN ROC(63,1) {3 mth %} add column separator ADD COLUMN ROC(21,1) {1 mth %} add column separator ADD COLUMN vol63 {vol(%)} add column separator add column sharpe {sharpe ratio} add column separator add column allocation {Allocation (%)} add column separator add column corr(spy,63, close) {S&P500 Cor.} add column separator add column RSI(9) add column separator add column RSI(30) add column separator add column WEEKLY IFT(2,1){IFT} add column separator add column MA(200) and draw CCI (20) line at 100.00 and draw CCI (20) line at 50 and draw CCI (20) line at 10 and draw Slow Stochastic(5,1) Fast %K line at 20.00 and draw Slow Stochastic(5,1) Fast %K line at 80.00 and draw Slow Stochastic(5,1) Fast %K line at 50.00 and draw MACD Fast Line(12,26) line at 0 and draw RSI(30) line at 50 and Draw RSI(9) on plot RSI(30) DRAW WEEKLY IFT(2,1) DRAW WEEKLY IFT(2,1) LINE AT .90 DRAW WEEKLY IFT(2,1) LINE AT -.90 DRAW WEEKLY IFT(2,1) LINE AT 0 SORT ON COLUMN 6 ascending CHART-TIME IS 120 days draw MA(3) draw sharpe line at 0 ] |
davesaint86 725 posts msg #134299 - Ignore davesaint86 |
2/14/2017 3:59:05 PM Nope. I want to be able to add a least two more funds for a total of 13 not eleven. |
four 5,087 posts msg #134300 - Ignore four modified |
2/14/2017 6:55:13 PM added... schb,schc,schd 14 results from Tuesday February 14, 2017 - Close Results Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. ----------------- symlist(iws,xly,xlp,xle,xlf,xlv,xli,xlb,xlre,xlk,xlu,schb,schc,schd) SET{perf1A, ma(3) 60 days ago} SET{perf1b, MA(3) / perf1a} SET{perf, perf1b - 1} SET{var1, perf*100} SET{rfr, ind(^irx,close)} SET{RISKFREERETURN, rfr/100} SET{perf63, perf - RISKFREERETURN} SET{STD63, CSTDDEV(CLOSE,63)} SET{VOL63a, STD63 / MA(63)} SET{vol63, vol63a * 100} /*CALCULATION OF SHARPE RATIO - ANNUALIZED*/ SET{SHARPE1a, perf63 / VOL63a} set{sharpe, sharpe1a * 0.5} set{var1a, IND(iws, sharpe)} set{var1b, IND(xly, sharpe)} set{var1c, IND(xlp, sharpe)} set{var1d, IND(xle, sharpe)} set{var1e, IND(xlf, sharpe)} set{var1f, IND(xlv, sharpe)} set{var1g, IND(xli, sharpe)} set{var1h, IND(xlb, sharpe)} set{var1i, IND(xlre, sharpe)} set{var1j, IND(xlk, sharpe)} set{var1k, IND(xlu,sharpe)} SET{RANK1A, COUNT(sharpe is above var1a,1)} SET{RANK1B, COUNT(sharpe is above var1b,1)} SET{RANK1C, COUNT(sharpe is above var1c,1)} SET{RANK1D, COUNT(sharpe is above var1d,1)} SET{RANK1E, COUNT(sharpe is above var1e,1)} SET{RANK1F, COUNT(sharpe is above var1f,1)} SET{RANK1G, COUNT(sharpe is above var1g,1)} SET{RANK1H, COUNT(sharpe is above var1h,1)} SET{RANK1I, COUNT(sharpe is above var1i,1)} SET{RANK1J, COUNT(sharpe is above var1j,1)} SET{RANK1K, COUNT(sharpe is above var1k,1)} SET{RANK1L, RANK1A + RANK1B} SET{RANK1M, RANK1C + RANK1D} SET{RANK1N, RANK1E + RANK1F} SET{RANK1O, RANK1G + RANK1H} SET{RANK1P, RANK1I + RANK1J} SET{RANK1Q, RANK1K + RANK1L} SET{RANK1R, RANK1M + RANK1N} SET{RANK1S, RANK1O + RANK1P} SET{RANK1T, RANK1Q + RANK1R} SET{RANK1U, RANK1S + RANK1T} SET{RANK, 11 - RANK1U} set{var2a, IND(iws, sharpe)} set{var2b, IND(xly, sharpe)} set{var2c, IND(xlp, sharpe)} set{var2d, IND(xle, sharpe)} set{var2e, IND(xlf, sharpe)} set{var2f, IND(xlv, sharpe)} set{var2g, IND(xli, sharpe)} set{var2h, IND(xlb, sharpe)} set{var2i, IND(xlre, sharpe)} set{var2j, IND(xlk, sharpe)} set{var2k, IND(xlu, sharpe)} SET{var3a, COUNT(var2a is above 0,1)} SET{var3b, COUNT(var2b is above 0,1)} SET{var3c, COUNT(var2c is above 0,1)} SET{var3d, COUNT(var2d is above 0,1)} SET{var3e, COUNT(var2e is above 0,1)} SET{var3f, COUNT(var2f is above 0,1)} SET{var3g, COUNT(var2g is above 0,1)} SET{var3h, COUNT(var2h is above 0,1)} SET{var3i, COUNT(var2i is above 0,1)} SET{var3j, COUNT(var2j is above 0,1)} SET{var3k, COUNT(var2k is above 0,1)} SET{var4a, var2a * var3a} SET{var4b, var2b * var3b} SET{var4c, var2c * var3c} SET{var4d, var2d * var3d} SET{var4e, var2e * var3e} SET{var4f, var2f * var3f} SET{var4g, var2g * var3g} SET{var4h, var2h * var3h} SET{var4i, var2i * var3i} SET{var4j, var2j * var3j} SET{var4k, var2k * var3k} set{var5a, var4a + var4b} set{var5b, var4c + var4d} set{var5c, var4e + var4f} set{var5d, var4g + var4h} set{var5e, var4i + var4j} set{var5f, var4k} set{var5g, var5a + var5b} set{var5h, var5c + var5d} set{var5i, var5e + var5f} set{var5j, var5g + var5h} set{var5k, var5j + var5i} SET{allocation1, sharpe / var5k} set{allocation2, allocation1 * count(sharpe above 0,1)} set{allocation, allocation2 *100} SET{TI42, MA(4) / MA(42)} ADD COLUMN SEPARATOR ADD COLUMN RANK {Rank} ADD COLUMN SEPARATOR ADD COLUMN TI42 DD COLUMN SEPARATOR add column atr(21) {Atr$} add column separator add column average day range (21){ADR%} ADD COLUMN SEPARATOR ADD COLUMN ROC(126,1) {6 mth %} add column separator ADD COLUMN ROC(63,1) {3 mth %} add column separator ADD COLUMN ROC(21,1) {1 mth %} add column separator ADD COLUMN vol63 {vol(%)} add column separator add column sharpe {sharpe ratio} add column separator add column allocation {Allocation (%)} add column separator add column corr(spy,63, close) {S&P500 Cor.} add column separator add column RSI(9) add column separator add column RSI(30) add column separator add column WEEKLY IFT(2,1){IFT} add column separator add column MA(200) and draw CCI (20) line at 100.00 and draw CCI (20) line at 50 and draw CCI (20) line at 10 and draw Slow Stochastic(5,1) Fast %K line at 20.00 and draw Slow Stochastic(5,1) Fast %K line at 80.00 and draw Slow Stochastic(5,1) Fast %K line at 50.00 and draw MACD Fast Line(12,26) line at 0 and draw RSI(30) line at 50 and Draw RSI(9) on plot RSI(30) DRAW WEEKLY IFT(2,1) DRAW WEEKLY IFT(2,1) LINE AT .90 DRAW WEEKLY IFT(2,1) LINE AT -.90 DRAW WEEKLY IFT(2,1) LINE AT 0 SORT ON COLUMN 6 ascending CHART-TIME IS 120 days draw MA(3) draw sharpe line at 0 |
Kevin_in_GA 4,599 posts msg #134301 - Ignore Kevin_in_GA |
2/14/2017 7:04:54 PM How about this? SF added the Sharpe and Sortino ratio functions a while back - just use this on a symlist with your preferred ETFs. |
davesaint86 725 posts msg #134305 - Ignore davesaint86 modified |
2/14/2017 8:13:25 PM Thank you Safetrade, Kevin and Four. |
four 5,087 posts msg #134307 - Ignore four |
2/14/2017 8:22:05 PM welcome |
davesaint86 725 posts msg #134315 - Ignore davesaint86 |
2/15/2017 9:14:16 AM Kevin, If I wanted to create an Alpha score like you did when you had to code the 21 day and 63 day Sharpe Ratios would the simplified code for doing be shown below? SET{21ALPHA, Sharpe Ratio(21) * 100} SET{63ALPHA, Sharpe Ratio(63) * 100} SET{ALPHA_SCORE, 63ALPHA + 21ALPHA} |
Kevin_in_GA 4,599 posts msg #134319 - Ignore Kevin_in_GA |
2/15/2017 9:47:33 AM You approach is correct, but technically alpha is the measure of excess returns relative to the S&P 500, which would look more like this: You can just substitute the Sharpe Ratio(21) and Sharpe ratio(63) in for the ROC() function if you want. |
davesaint86 725 posts msg #134320 - Ignore davesaint86 |
2/15/2017 10:04:42 AM Thank you Kevin |
StockFetcher Forums · Filter Exchange · Sharpe Allocation Filter - 11 ETS Want to Add Two More | << >>Post Follow-up |
Copyright 2022 - Vestyl Software L.L.C.•Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data
Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus