PyInvesting

Discussion

How the backtest select 3 stocks out of 30 stocks in the moving average test

5 years, 10 months ago 763 views

Hi Ivan,

Just to understand how the system determine the 3 stocks for the period of backtest out of universe of say 30 stocks.

If we select only the stocks that perform the best, this will best fit the backtest?

 

Thanks

Contribute

Add to the discussion

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

5 replies

5 years, 10 months ago

Yes if the fundamental factor works, it should outperform the default selection in the long run. 

Default means the strategy picks randomly whichever stock comes first. 

No worries, I'm happy to answer any questions you might have. Don't hesitate to ask.

5 years, 10 months ago

Hi Ivann,

 

Thanks, so in a way if the fundamentals are selected, the result should be more positive than the by default selection. Is this true?

Also the "by default" means ?

 

Sorry for having so many questions. Thanks for answering

5 years, 10 months ago

If you don't assign any weights for the signals there is no way to rank the stocks if more than 3 of them are above the 200 SMA. The system will just select 3 stocks by default. 

5 years, 10 months ago

Hi Ivan,

If I only take moving average and put 0 to the fundamentals weight, so the system will pick up base on moving average. Assuming that it is working this way than I believe it should be more than 3 stocks that will over 200 SMA, so how the system handle that?

 

Thanks.

5 years, 10 months ago

Hi Benedict, 

In your example you are starting with 30 stocks and the algorithm will pick 3 stocks based on the signals you select. For example if you specify that you want stocks with low PE ratio, every rebalancing period the strategy will pick the top 3 stocks with the lowest PE ratio. 

Kind Regards,

Ivan