Overall Statistics Total Trades51Average Win5.97%Average Loss-0.25%Compounding Annual Return21.553%Drawdown17.800%Expectancy15.697Net Profit291.012%Sharpe Ratio1.06Loss Rate33%Win Rate67%Profit-Loss Ratio24.05Alpha0.081Beta0.871Annual Standard Deviation0.163Annual Variance0.027Information Ratio0.615Tracking Error0.109Treynor Ratio0.198Total Fees\$69.88
```namespace QuantConnect
{
/*
*   QuantConnect University: Full Basic Template:
*
*   The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
*   We have explained some of these here, but the full algorithm can be found at:
*   https://github.com/QuantConnect/Lean/tree/master/Algorithm
*/
/// <summary>
/// Basic template algorithm simply initializes the date range and cash
/// </summary>
public class LRP : QCAlgorithm
{
//the leverage for each holding
decimal leverage = 2.5m;
//the months to perform rebalance
int[] months = { 3, 6, 9, 12 };

/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2010, 1, 07);  //Set Start Date
SetEndDate(2017, 1, 1);    //Set End Date
SetCash(100000);             //Set Strategy Cash. Should be 3 month T Bills.

//using etf rather than options

Schedule.On(DateRules.MonthStart(), TimeRules.AfterMarketOpen("SPY"), () =>
{
if (months.Contains(Time.Month))
{
//yearly rebalancing
SetHoldings("SPY", 0.5m * leverage);
SetHoldings("TLT", 0.4m * leverage);
SetHoldings("GLD", 0.1m * leverage);
Debug("Rebalance");
}
});
}

/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
SetHoldings("SPY", 0.5m * leverage);
SetHoldings("TLT", 0.4m * leverage);
SetHoldings("GLD", 0.1m * leverage);
Debug("Purchased Stock");
}
}

}
}```