Overall Statistics
Total Trades
472
Average Win
0.32%
Average Loss
-0.33%
Compounding Annual Return
8.403%
Drawdown
20.300%
Expectancy
0.899
Net Profit
199.955%
Sharpe Ratio
0.883
Probabilistic Sharpe Ratio
27.581%
Loss Rate
3%
Win Rate
97%
Profit-Loss Ratio
0.96
Alpha
0.075
Beta
-0.034
Annual Standard Deviation
0.082
Annual Variance
0.007
Information Ratio
-0.07
Tracking Error
0.193
Treynor Ratio
-2.147
Total Fees
$476.77
namespace QuantConnect.Algorithm.CSharp
{
    public class Markowitz : QCAlgorithm
    {

        public override void Initialize()
        {
            SetStartDate(2006, 1, 1);  //Set Start Date
            SetEndDate(2019, 08, 10);
            SetCash(100000);             //Set Strategy Cash
            
			UniverseSettings.Resolution = Resolution.Daily;
			var symbols = new[] { QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA),
									QuantConnect.Symbol.Create("TLT", SecurityType.Equity, Market.USA),
									QuantConnect.Symbol.Create("GLD", SecurityType.Equity, Market.USA) };
			SetUniverseSelection( new ManualUniverseSelectionModel(symbols) );
			
			AddAlpha(new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromDays(365*20), 1, null, null));
			
			
			SetPortfolioConstruction(new MeanVarianceOptimizationPortfolioConstructionModel(
										TimeSpan.FromDays(30),
							            PortfolioBias.Long,
							            1,
							            63,
							            Resolution.Daily,
							            0.02,
							            null));
			
			/*				            
			SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel(
										TimeSpan.FromDays(30),
							            PortfolioBias.Long));
			*/
			
			SetExecution(new ImmediateExecutionModel());
			
			AddRiskManagement(new NullRiskManagementModel());

        }

        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// Slice object keyed by symbol containing the stock data
        public override void OnData(Slice data)
        {
            // if (!Portfolio.Invested)
            // {
            //    SetHoldings(_spy, 1);
            //    Debug("Purchased Stock");
            //}
        }

    }
}