Glanies Takahata
Follow
1 month, 1 week ago · 304 Views

Hello Pyinvesting folks,
I ran a Moving Average backtest with a 200 US stock universe and landed on this portfolio that seems too good to be true. See the attached picture for the statistics. I intend to implement this portfolio but am a little spooked by how good the statistics are. Despite the bubbly bull run from late last year to early this year for US stocks, the strategy has outperformed the index in 9 out of 10 years. Total returns also greatly surpassed the index by a huge margin.
I am aware that by investing and holding the basket of 30 US stocks generated by this portfolio, I will be subject to the usual cons of investing in the US stock markets (forex risk, 30% withholding tax on dividends and estate tax issues). For now, it seems that the upside far outweighs the downside. I am also aware that past performance is no predictor of future performance. Given these considerations, I wonder if any of you can offer me alternative perspectives about this portfolio, and if you see any reason why I should proceed with caution?
Hi Glanies,
B1. The prices used to calculate your positions are settle prices from the previous business day that generates your orders today. Because of this, there is a difference in the cash you calculate on the day itself and the cash the model calculates which is based on the previous day's price.
B2. If the leverage is large with a large negative cash allocation or higher than expected cash allocation, it means the model has over ordered or under ordered stocks because of the jump in prices overnight. The threshold for this is subjective as different people have different tolerance for tracking error.
B3. The model is meant as a guide for you. Some tracking error is inevitable but yes you should continue trusting the model and following the strategy you selected.
B4. If you don't feel comfortable with using some margin, just take your portfolio value, divide that value by the number of stocks in your portfolio (equal weighted), and calculate number of lots you need to buy for each stock. For example if you have 30 stocks in your portfolio, just divide 100 by 30 and each stock will have a weight of 3.3%.
B5. Yup makes good sense to me. The model is meant as a guide to help you. Having some tracking error is expected but it's fine. The most important thing is to start investing and let your money compound in the stock market.
Happy to help, do let us know if you have any questions!
Glanies Takahata
Follow
1 month, 1 week ago

Thank you so much for the tips, Ivan.
I did as you suggested for this strategy with a rebalancing band of 20% (Note: link was shared in an earlier post) on an excel spreadsheet and noticed the following:
A1. After following the orders prescribed in the Portfolio section and the Simulated Orders section, I ended up with a portfolio of 29 counters which totals 122% and a cash component of 16%. The total portfolio adds up to 105%.
A2. Some counters have a weight of 2+% while some have a weight of 6.6%.
A3. Assuming my portfolio value is USD30,000, should I implement the strategy based on these numbers, all 29 counters (122%) will cost me USD36,300. So on top of my USD30,000, I'd need to borrow USD6,300 to implement it. The negative cash component (16%) works out to USD4,800.
Thanks for sharing about VIX, and that a large spike in VIX will result in a larger model tracking error.
My questions are:
B1. Why is the negative cash component 16% instead of 21%? At 21%, it will work out to be USD6,300 which correspond to the loan amount in A3, and it will also allow the portfolio to total 100% and not 105%.
B2. How do I conclusively prove that the model has indeed overordered due to the spike in VIX? Does the fact that all 29 counters add up to 122.1% mean that it has indeed overordered?
B3. Assuming B1 is correct, do I then continue to trust the model and implement it as prescribed? If I do, I will end up with what I described in A3.
B4. If I should not trust the model entirely in such scenarios, what manual adjustments do I have to make in order to make up for the model's overordering?
B5. Finally, if I do not want to maintain any negative cash (i.e. don't want to take a loan), and want to only deploy USD30,000, I would take it that USD30,000 is 122% and split the principal across the 29 counters based on their weightage, yes?
Thanks for your patience in guiding me to make the most of PyInvesting!
Hi Glanies,
In the portfolio section, it will tell you the weight of each stock as a percentage. What you can do is take your current portfolio value and multiply it by the weight to get the value of each position. From there divide it by the current real time price in the market to get the number of lots you need to trade. This would account for large swings in price movements.
One way you can tell that there is going to be over/under ordering by the model would be to look at the VIX which is a volatility index. If the VIX spikes there will be a huge price movement resulting in a larger model tracking error. Hope this helps!
Kind regards,
The PyInvesting Team
Glanies Takahata
Follow
1 month, 1 week ago

I see. In such cases, do we then follow the model? Or be aware that the model is ordering more than it should, and give it a day to adjust?
I intend to implement the strategy in in the next few days.
Do I follow the model to overpurchase and therefore maintain a leverage? I'm comfortable with doing so. But before I proceed, I'd like to understand what the journey ahead would look like. Under what circumstances would the model "correct" itself following a big drop and subsequent overordering? Also, as I go along, how do I determine that the model is overordering? Would a larger than x negative cash amount (e.g. 10% and above) be the indicator?
The reason is the violent price movements we saw over the last week. The orders are made based on the close price from the previous day. On some days when the market drops big when it opens, the model orders more than it should as it's assuming the portfolio value is based on yesterday's price.
Glanies Takahata
Follow
1 month, 1 week ago

Got it. Thanks!
I ran the backtest again, this time with a rebalancing band of 20%. It turned out that my negative cash increased to 16%. What could be the reason leading to the increase in leverage?
Here's the link to the results. I'm not sure if you can access it.
https://pyinvesting.com/invest/results/817ec2ac819547bda296b03001037a7d
Hi Glanies,
The backtester uses adjusted close prices which accounts for the returns from dividends, and handles stock splits. No it does not include the 30% withholding tax on dividends affecting non US investors.
Kind regards,
The PyInvesting Team
Glanies Takahata
Follow
1 month, 1 week ago

Thanks for the feedback Ivan.
I'd like to find out if the returns include yields from dividends or if the returns are based only on changes in the stock prices? Do the returns also take into account the 30% withholding tax on dividends that we face as nonUS investors?
Hi Glanies,
Interesting strategy! I like that you have 30 stocks in the portfolio which is diversified and has low concentration risk.
If you look at the positions chart below, you can see some leverage being used (negative cash). This is because your rebalance band (in advanced settings) is a little high at 50%. Maybe you can try to tighten the rebalance band from 50% to 20% to allow your positions to be closer to the target weight.
Finally, one way to proceed with caution would be to deploy half of your capital at first to get a feel for how the strategy works. Once you are more comfortable with the strategy, you can then deploy the other half of your capital.
Kind regards,
The PyInvesting Team
PyInvesting Pte Ltd Company UEN: 202035333Z
© PyInvesting 2021