StockFetcher Forums · Filter Exchange · PORTFOLIO SELECTION AND MANAGEMENT USING RISK/REWARD RATIOS<< 1 ... 50 51 52 53 54 ... 65 >>Post Follow-up
sohailmithani
192 posts
msg #119821
Ignore sohailmithani
5/14/2014 7:28:21 PM

Can this filter be used to pick stocks from index best performing or at least having a positive sharpe.
What I want is adding this filter to my stock selection filter and on a daily basis select stocks from index which is best or with positive sharpe.

However, not able to include this code to my own filter. Can someone comment and help in coding this one.

Thanks

bcochrane
4 posts
msg #120049
Ignore bcochrane
5/24/2014 12:26:12 PM

sohailmithani

You may find Page 31 of this thread useful

sohailmithani
192 posts
msg #120051
Ignore sohailmithani
5/24/2014 2:16:43 PM

Thanks

davesaint86
725 posts
msg #120726
Ignore davesaint86
modified
6/12/2014 10:40:55 PM

Below is Kevin's Sharpe-Ration Allocation filter. I tried building a 10 ETF version and haven't had any luck getting right. I was able to figure out setting up the current rankings correctly but the the % Allocation. I would appreciate some help!!! Thanks!

Fetcher[


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(AGG, var1)}
set{var1b, IND(IVV, var1)}
set{var1c, IND(EFA, var1)}
set{var1d, IND(IWM, var1)}
set{var1e, IND(IWB, var1)}
set{var1f, IND(IGM, var1)}
set{var1g, IND(BA, var1)}
set{var1h, IND(VXF, var1)}
set{var1i, IND(ACIM, var1)}
set{var1j, IND(IXJ, var1)}
set{var1k, IND(SHY, 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(AGG, sharpe)}
set{var2b, IND(IVV, sharpe)}
set{var2c, IND(EFA, sharpe)}
set{var2d, IND(IWM, sharpe)}
set{var2e, IND(IWB, sharpe)}
set{var2f, IND(IGM, sharpe)}
set{var2g, IND(BA, sharpe)}
set{var2h, IND(VXF, sharpe)}
set{var2i, IND(ACIM, sharpe)}
set{var2j, IND(IXJ, sharpe)}
set{var2k, IND(SHY, 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 + var4j}





SET{allocation1, sharpe / var5f}
set{allocation2, allocation1 * count(sharpe above 0,1)}
set{allocation, allocation2 *100}


symlist(agg,ivv,efa,iwm,iwb,igm,ba,vxf,acim,ixj,shy)
ADD COLUMN SEPARATOR
ADD COLUMN RANK {TAA current rank}
ADD COLUMN SEPARATOR
ADD COLUMN var1 {3 month return (%)}
ADD COLUMN vol63 {volatility (%)}
add column sharpe {sharpe ratio}
add column allocation {Sharpe-based allocation (%)}
add column corr(spy,63, close) {correlation to S&P 500}

SORT ON COLUMN 6 ascending
CHART-TIME IS 60 days
draw MA(3)
draw sharpe line at 0

]



davesaint86
725 posts
msg #120727
Ignore davesaint86
modified
6/12/2014 10:44:24 PM

Duplicate

jackmack
334 posts
msg #120739
Ignore jackmack
6/13/2014 12:31:06 PM

Kevin
Curious how on your site it's EFA but from the yahoo page for 2/28/2014-5/30/2014 (3 month lookback) it was SPY.
Can you advise what I missed?
Thank you
Cheers

manumoneya
41 posts
msg #120746
Ignore manumoneya
6/13/2014 10:08:06 PM

remove this line

ADD COLUMN RANK {TAA current rank}

i don't know why it is causing problem....




jimmyjazz
102 posts
msg #120747
Ignore jimmyjazz
6/13/2014 10:55:40 PM

jackmack, the starting date matters. Compare a start date of 2/28/14 to 3/3/14. The selected ETF switches from SPY to EFA.

dashover
226 posts
msg #120759
Ignore dashover
6/16/2014 11:55:58 AM

symlist(spy,iwm,efa,agg,)

sort on column 5 descending

set{diff2,close minus close 68 days ago}
set{diff2%,diff2 / close 68 days ago}
set{ratio90,diff2% * 100}


add column ratio90


----------

Says EFA, Is this correct?

jackmack
334 posts
msg #120768
Ignore jackmack
6/16/2014 3:02:56 PM

Sorry jimmyjazz - but that is not the way the filter is to be used.
The review is the last day of the month not the first day of the next month
so I am still not sure where Kevin got EFA for June because neither the
yahoo link or the most up to date version of the look back filter had EFA as
the top pick - it was SPY in both cases.

StockFetcher Forums · Filter Exchange · PORTFOLIO SELECTION AND MANAGEMENT USING RISK/REWARD RATIOS<< 1 ... 50 51 52 53 54 ... 65 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


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


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.