Hello, I'm trying to build a simple example to maximize the return on a portfolio with a risk target (12%) and long positions only (0 <= weights <=1). I've read all the previous posts on fPortfolio and PortfolioAnalytics but I cannot find anything simple. Could you please help me? My code currently looks like this: library(fPortfolio) library(PortfolioAnalytics) TargetRisk<-0.12 #my target risk = sd ## return data Data <- SMALLCAP.RET Data <- Data[, c("BKE", "GG", "GYMB", "KRON")] Regards [[alternative HTML version deleted]]