StockFetcher Forums · Filter Exchange · Risk-adjusted Beta %Return<< >>Post Follow-up
glgene
613 posts
msg #159923
Ignore glgene
12/25/2022 5:29:52 PM

Ed S. (Nibor100) -- You reported in a previous post (under 'Bouncy Ball Scan') that StockFetcher uses only one (1) calculation number for Beta (36 months).

I would like to calculate a Risk-adjusted Beta $%Return.
Question: If SF's Beta period covers exactly 36 months (3 years), but the maximum ROC period allowed by SF is 24 months (2 years), how would one calculate an "apples-to-apples, same-period" Risk-adjusted %Return?"

Below is my attempt with an SF script to accomplish the project...but as you can see, I'm using a 3-year Beta with a 2-year ROC. Houston, we have a problem! Any way, the sort is the final column (a higher score would be better, I think).

Any suggestions to solve my scripting concern? Thanks in advance.

Fetcher[
/* Test for Risk-adjusted Beta %Return */

dow 30

add column separator
add column weekly roc(13){3-mos._ROC}
add column weekly roc(26){6-mos._ROC}
add column weekly roc(52){1-year_ROC}
add column separator
add column separator
add column separator
add column weekly roc(104){2-yrs._ROC}
add column beta{beta, 3 yrs.}
set{calc, weekly roc(104)/beta}
add column calc{risk-adj. beta %return}
add column separator
add column separator
add column separator

draw calc

sort column 14 descending
]



nibor100
1,008 posts
msg #159924
Ignore nibor100
12/26/2022 12:52:39 PM

Hey Gene,
Try this rough version and note the SF anomaly in the custom roc calc
Ed S.

Fetcher[
/* Test for Risk-adjusted Beta %Return */

dow 30

add column separator
add column weekly roc(13){3-mos._ROC}
add column weekly roc(26){6-mos._ROC}
add column weekly roc(52){1-year_ROC}
add column separator
add column separator
add column separator
add column weekly roc(104){2-yrs._ROC}
add column beta{beta, 3 yrs.}
set{calc, weekly roc(104)/beta}
add column calc{risk-adj. beta %return}
add column separator
add column separator
add column separator

draw calc

sort column 14 descending

set{ind_change, close - close 3 years ago} add column close 3 years ago add column ind_change
set{ind_ratio, ind_change / close 3 years ago} add column ind_ratio
set{custom_roc, ind_ratio * 100.0} add column custom_roc
and add column custom_roc divided by beta
]



glgene
613 posts
msg #159925
Ignore glgene
12/26/2022 11:04:45 PM

Ed,

I didn’t know SF had 3+ years of price data. I thought the limitation was 2 years. Once again you came thru with a scripting solution … this time, to my “Beta-adjusted ROC” project (matching 3 years of price to 3 years of Beta calculation. (Apples-to-Apples.)

I’ll merge your 3 years of price data solution into my final script … and post it here for your (and others) 2nd review and constructive comment. I have already added 3 or 4 other columns of useful info.

Gene in FL

glgene
613 posts
msg #159950
Ignore glgene
1/2/2023 12:31:20 PM

Ed S (Nibor) --- SOS! When I run your additional lines added to my original script, I can't match the sales price 3 years ago. Your heading (3 yrs. ago price) references "741." We spoke about that briefly, but I still can't tie it to any matching price (around 3 years ago).

I tried it with a dividend-paying stock and a non-dividend-paying stock. Still couldn't match 3 yrs. ago price.

I don't know what else to do. Any suggestions?

Gene in FL

SAFeTRADE
629 posts
msg #159951
Ignore SAFeTRADE
1/3/2023 9:04:53 AM

stockfetcher only has 2 years of data.

nibor100
1,008 posts
msg #159952
Ignore nibor100
1/3/2023 10:06:30 AM

@Safetrade,

SF has lots of years of data if you know the odd techniques of getting to it.

a. Xarlor has been able to get all time stock highs more than 10 years ago on SF.

b. If you drag any Sf 2 year chart in a browser window to the right you will see an additional year of chart data to the left. But to go beyond 3 years in history there are only a few ways to get to that older data.

Ed S.

nibor100
1,008 posts
msg #159953
Ignore nibor100
1/3/2023 10:13:42 AM

@glgene,

Unfortunately, SF data sometimes has data errors, which seems to be the case for MRK. but if you check Apple you'll find exact matches for 1 year back, 2 years back, and 3 years back running my script. Remember the math, 1 year = 252, in SF its more like 247, 2 yrs 504 in SF 494, 3 yrs 756 in SF 741, starting at this point in time. I don't know why SF eliminates some extra trading days in the year.

Also, since it less days in a trading year the values will be later in January the further back in time you look.

Hope this helps,
Ed S.

fotchstecker
304 posts
msg #159957
Ignore fotchstecker
1/4/2023 11:28:48 AM

"Unfortunately, SF data sometimes has data errors"

To start. These data have survivor bias issues, too.

The lack of real backtesting with scrubbed historical data make SF a pretty big guessing game. Good for validating certain kinds of ideas. Can't really properly size positions, or even construct a portfolio size, without being able to get even the most basic stats.

StockFetcher Forums · Filter Exchange · Risk-adjusted Beta %Return<< >>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.