# How to find best-performing portfolios from an universe of stocks

I am a newbie in R.

From an investment universe of around 150 international stocks, I want to find the five best-performing portfolios (each containing 20 stocks) in terms of return for the period 2013-2017 under the constraints: a concrete range for the individual weights, a concrete standard deviation of the portfolio, long only, full investment.

Is it possible to do this reliably and what approach would you recommend? For example, using for loop or some apply function or some approach on portfolio optimization?

I am asking just for a short advice in which direction to go.

Unless you have some weird weight constraints (e.g. equally weighted) it is not possible to derive something like the porfolio with the second highest return, since the weights are in $\mathbb{R}$.