PyInvesting

Discussion

Enquiry on Relative Strength

5 years, 9 months ago 493 views

Hi Ivan,

I am a bit clueless on how the stocks are determined for the backtest attached wrt Relative Strength and MA.

Do both RS and MA have to display a positive signal before the stocks are then filtered by the allocated weights set by me? 

Lastly, i have downloaded the 'positions' as excel and found that there are 113 stocks listed even though i have included 150 at the start. Is my excel displaying wrongly? 

Really appreciate if you could help me understand this backtest further. Thank you.

Contribute

Add to the discussion

Share an answer, source, or follow-up question.

4 replies

5 years, 9 months ago

Hi Ivann,

Thanks alot. Appreciate it!

5 years, 9 months ago

Hi MKH,

No worries! The key difference is that the relative strength backtest will select the top few stocks based on the ranking during each rebalancing. However, the moving average backtest will not sell an existing stock even if the ranking drops unless the stock's price falls below the moving average. This reduces trading and transaction cost as we only sell the stock when the trend changes. 

Kind regards,

The PyInvesting Team

5 years, 9 months ago

Hi Ivann,

Thanks for the speedy reply. Hope you dont mind another newbie question, how will this strategy differs from the moving average backtest then?

5 years, 9 months ago

Hi MKH,

You specified the 200 day moving average as a filter so the 150 stocks in your investment universe is screened first to select stocks above their 200 day moving average.

Next, the relative strength backtest selects stocks with the highest signals based on the signals you selected which are:
1. Highest 12 Month returns
2. Lowest PE ratio
3. Highest Return on Equity
4. Highest Profit Growth
5. Highest Volatility

These 5 signals are combined using your weight of 20% each to form the overall signal. 

The stocks are then ranked using this overall signal and the best 10 stocks are selected every week. 

Your excel sheet only shows 113 stocks because some stocks were never selected by your strategy because they were filtered by the moving average screen or did not have an overall signal that ranks high enough. Hope this helps!

Kind regards
The PyInvesting Team