2 month SMA calculation in Portfoliovisualizer . . .

Discuss all general (i.e. non-personal) investing questions and issues, investing news, and theory.
Post Reply
Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 5:56 am

Despite 3 college degrees and passing AP calculus in high school some 25 years ago, I can't figure out how portfoliovisualizer got its number for a 2-month simple moving average for VFINX. You'll find it if you click the "Timing Periods" tab and then scroll to the bottom:
https://www.portfoliovisualizer.com/tes ... total1=100

I'll quote it here as well:
Next period predicted allocation based on market data as of 08/13/2019.
Adjusted close of VFINX at $270.55 is 1.42% below its 2-month SMA at $274.44.
If someone could use the real numbers, etc., on how PV arrived at 274.44 as of yesterday, I'd appreciate it. :oops:

GrowthSeeker
Posts: 605
Joined: Tue May 15, 2018 10:14 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by GrowthSeeker » Wed Aug 14, 2019 8:43 am

samsdad wrote:
Wed Aug 14, 2019 5:56 am
Despite 3 college degrees and passing AP calculus in high school some 25 years ago, I can't figure out how portfoliovisualizer got its number for a 2-month simple moving average for VFINX. You'll find it if you click the "Timing Periods" tab and then scroll to the bottom:

I'll quote it here as well:
Next period predicted allocation based on market data as of 08/13/2019.
Adjusted close of VFINX at $270.55 is 1.42% below its 2-month SMA at $274.44.
If someone could use the real numbers, etc., on how PV arrived at 274.44 as of yesterday, I'd appreciate it. :oops:
Of course, I don't know for sure, but I would imagine they average the closing price for the most recent 2 calendar months.
OTOH, I just went to yahoo and took historical data on VFINX from June 13 to Aug 12: I get an SMA of 273.02 which is quite different from 274.44.

So, you raise a good question.
Just because you're paranoid doesn't mean they're NOT out to get you.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 9:02 am

GrowthSeeker wrote:
Wed Aug 14, 2019 8:43 am
So, you raise a good question.
Thank goodness someone else can’t do it either. I’ve tried this with other tickers as well, and still get a different result than what PV says.

Perhaps someone else can solve the mystery . . .

Hydromod
Posts: 189
Joined: Tue Mar 26, 2019 10:21 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by Hydromod » Wed Aug 14, 2019 9:26 am

Did you check adjusted closing price or straight closing price?

PV may be including dividends...

Just a thought

GrowthSeeker
Posts: 605
Joined: Tue May 15, 2018 10:14 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by GrowthSeeker » Wed Aug 14, 2019 9:38 am

Well, if I take an SMA between 7/1/2019 and 8/12/2019, I get 274.43
Surely, that can't be it.
Just because you're paranoid doesn't mean they're NOT out to get you.

Hydromod
Posts: 189
Joined: Tue Mar 26, 2019 10:21 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by Hydromod » Wed Aug 14, 2019 9:42 am

Also, I think I noticed before that you get different results with 20-day versus 1-month.

Maybe specifying in days is the more precise way to go.

GrowthSeeker
Posts: 605
Joined: Tue May 15, 2018 10:14 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by GrowthSeeker » Wed Aug 14, 2019 9:51 am

Hydromod wrote:
Wed Aug 14, 2019 9:26 am
Did you check adjusted closing price or straight closing price?

PV may be including dividends...

Just a thought
Good thought.
Whether I start from June 11 up to June 14, and then go to Aug 12 or Aug 13,
the largest SMA for adjusted close is 273.18
the largest SMA for close is 273.43

And end of June / beginning of July were after the last div so close and adj. close were the same.
Just because you're paranoid doesn't mean they're NOT out to get you.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 9:59 am

GrowthSeeker wrote:
Wed Aug 14, 2019 9:51 am
Hydromod wrote:
Wed Aug 14, 2019 9:26 am
Did you check adjusted closing price or straight closing price?

PV may be including dividends...

Just a thought
Good thought.
Whether I start from June 11 up to June 14, and then go to Aug 12 or Aug 13,
the largest SMA for adjusted close is 273.18
the largest SMA for close is 273.43

And end of June / beginning of July were after the last div so close and adj. close were the same.
Well, PV does reference the "adjusted close" so I'm inclined to believe those are the numbers we should be looking at. I'm happy to try it with a different ticker of your choosing to see if we can gain clues from a second reference.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 10:07 am

Since I managed to rope you two into this :D , check out what I wrote in another thread below. Both can't be right...
samsdad wrote:
Tue Aug 13, 2019 3:50 pm
I have a PortfolioVisualizer question for you PV experts:

I'm considering using a 2-month SMA (monthly rebalancing) strategy like this*: https://www.portfoliovisualizer.com/tes ... total1=100

When I try to convert the 2-month timing period into days, such as 42, or 60, etc. I get a very different CAGR. Does anyone know what the appropriate conversion is?

The reason I ask is because I'd like to just set up a chart over at Fidelity that would tell me what I need to know and skip PV (which would also be easier for my wife just in case something happens to me, etc.) But Fidelity only has a SMA chart in days, not months, and thus the problem.

To make matters worse, I just noticed it that Fidelity and PV have different takes on what the 60-day (for example) SMA is as of yesterday, the 12th. Fidelity thinks it was $53.22:

Image

And PV thinks it was $53.18:

Image
Perhaps you see something in this additional data point.

kardan
Posts: 38
Joined: Sun Apr 28, 2019 9:56 am

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by kardan » Wed Aug 14, 2019 10:22 am

This is just a guess, but I believe they are starting with July 1 which results in a SMA of 274.43 using Yahoo adjusted close data. Since we are in August, I think PV may be anchoring on July 1 as the starting point and uses the logic the SMA will be correct at the end of August. Even though they allow some days-based inputs, their backtests and models seem to all be month based. If the math works similarly with today's close added in, I think that would be reasonable confirmation of my suspicion.

I was having a similar problem in determining how PV calculates their portfolio allocations for the target volatility models on an intramonth basis when using 1 month volatility as the input. After some trial and error, I figured out that intramonth, PV does the calculation using 21 days regardless of the number of trading days in the month. On the last day of the month, they use the correct number of trading days for the calculation. I contacted them and they confirmed that's what they do.

The SMA calculation doesn't seem consistent with their approach with target volatility, but it wouldn't surprise me if they're anchoring the starting point. If you use the contact us button on PV, you'll get a response within 24 hours. I actually got an answer to my question on a Sunday.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 10:33 am

kardan wrote:
Wed Aug 14, 2019 10:22 am
This is just a guess, but I believe they are starting with July 1 which results in a SMA of 274.43 using Yahoo adjusted close data. Since we are in August, I think PV may be anchoring on July 1 as the starting point and uses the logic the SMA will be correct at the end of August. Even though they allow some days-based inputs, their backtests and models seem to all be month based. If the math works similarly with today's close added in, I think that would be reasonable confirmation of my suspicion.

I was having a similar problem in determining how PV calculates their portfolio allocations for the target volatility models on an intramonth basis when using 1 month volatility as the input. After some trial and error, I figured out that intramonth, PV does the calculation using 21 days regardless of the number of trading days in the month. On the last day of the month, they use the correct number of trading days for the calculation. I contacted them and they confirmed that's what they do.

The SMA calculation doesn't seem consistent with their approach with target volatility, but it wouldn't surprise me if they're anchoring the starting point. If you use the contact us button on PV, you'll get a response within 24 hours. I actually got an answer to my question on a Sunday.
Thanks for the info!

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 10:33 am

Gonna try another one. Here's what PV says about UPRO today:
Next period predicted allocation based on market data as of 08/13/2019.
Adjusted close of UPRO at $53.03 is 4.81% below its 2-month SMA at $55.71.
I'll try my hand by getting the yahoo data and starting July 1st...

EDIT: Well, starting July 1st through yesterday I get 55.75, which is close.

I'll email them and see what they say.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Wed Aug 14, 2019 3:23 pm

Got an email back from them. Here's what they said:
Normally when you define the moving averages in calendar month terms rather than in trading days, the end of month samples are used, so 2-month SMA would calculate the average of the most recent month’s and the previous month’s adjusted close. For intra-month signals the calendar month periods are converted into trading days using 21 trading days per month.

Topic Author
samsdad
Posts: 723
Joined: Sat Jan 02, 2016 6:20 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by samsdad » Thu Aug 15, 2019 9:14 am

kardan wrote:
Wed Aug 14, 2019 10:22 am
The SMA calculation doesn't seem consistent with their approach with target volatility, but it wouldn't surprise me if they're anchoring the starting point. If you use the contact us button on PV, you'll get a response within 24 hours. I actually got an answer to my question on a Sunday.
Hydromod wrote:
Wed Aug 14, 2019 9:42 am
Also, I think I noticed before that you get different results with 20-day versus 1-month.

Maybe specifying in days is the more precise way to go.
GrowthSeeker wrote:
Wed Aug 14, 2019 9:38 am
Well, if I take an SMA between 7/1/2019 and 8/12/2019, I get 274.43
Surely, that can't be it.
So, just in case their email to me left you scratching your head like it did me after some more trial and error, I finally figured out what they were saying, so here goes:

PV says this as of this morning:
Next period predicted allocation based on market data as of 08/14/2019.
Adjusted close of VFINX at $262.70 is 2.72% below its 2-month SMA at $270.04.
To get the 270.04, you're going to average just 2 numbers (duh): yesterday's adjusted close of $262.70 (which is the proxy for the second month's average), and the adjusted close of 21 trading days before yesterday, which here is July 16th (the proxy for the first month). The adjusted close of VFINX was $277.38 on July 16th. (262.70 + 277.38)/2=270.04. :D

Hope that helps you folks.

GrowthSeeker
Posts: 605
Joined: Tue May 15, 2018 10:14 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by GrowthSeeker » Thu Aug 15, 2019 11:36 am

samsdad wrote:
Thu Aug 15, 2019 9:14 am
To get the 270.04, you're going to average just 2 numbers (duh): yesterday's adjusted close of $262.70 (which is the proxy for the second month's average), and the adjusted close of 21 trading days before yesterday, which here is July 16th (the proxy for the first month). The adjusted close of VFINX was $277.38 on July 16th. (262.70 + 277.38)/2=270.04. :D

Hope that helps you folks.
You nailed it. I just verified, not that verification was needed.
So it is NOT a 2 month MOV. It is the average of C[0] and C[21], the closing prices today and 21 trading days ago. That explains why a moving average could jump from 274+ to 270+ in just a day or 2.
Just because you're paranoid doesn't mean they're NOT out to get you.

Hydromod
Posts: 189
Joined: Tue Mar 26, 2019 10:21 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by Hydromod » Thu Aug 15, 2019 12:27 pm

Is PV granular like this in other calculations?

The reason I ask, there were some recommendations made in Hedgefundie's thread to use PV output to determine adaptive risk parity weights using a one-month or three-month volatility look back period.

If PV granularity extends to risk parity or other calculations, then folks may have been led astray a smidge.

kardan
Posts: 38
Joined: Sun Apr 28, 2019 9:56 am

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by kardan » Thu Aug 15, 2019 2:01 pm

Hydromod wrote:
Thu Aug 15, 2019 12:27 pm
Is PV granular like this in other calculations?

The reason I ask, there were some recommendations made in Hedgefundie's thread to use PV output to determine adaptive risk parity weights using a one-month or three-month volatility look back period.

If PV granularity extends to risk parity or other calculations, then folks may have been led astray a smidge.
kardan wrote:
Wed Aug 14, 2019 10:22 am

I was having a similar problem in determining how PV calculates their portfolio allocations for the target volatility models on an intramonth basis when using 1 month volatility as the input. After some trial and error, I figured out that intramonth, PV does the calculation using 21 days regardless of the number of trading days in the month. On the last day of the month, they use the correct number of trading days for the calculation. I contacted them and they confirmed that's what they do.
I've been calculating adaptive risk parity rates and matching them to PV for several weeks using the approach outlined above. So although the intramonth vs end of month calculation is a little inconsistent, they are using daily values for the calculation.

Hydromod
Posts: 189
Joined: Tue Mar 26, 2019 10:21 pm

Re: 2 month SMA calculation in Portfoliovisualizer . . .

Post by Hydromod » Thu Aug 15, 2019 3:03 pm

kardan wrote:
Thu Aug 15, 2019 2:01 pm
I've been calculating adaptive risk parity rates and matching them to PV for several weeks using the approach outlined above. So although the intramonth vs end of month calculation is a little inconsistent, they are using daily values for the calculation.
Okay, folks shouldn't be very far off then. And a few percent difference in allocation won't make a hill of beans difference anyway.

Post Reply