Overall Statistics Total Trades8Average Win0%Average Loss0%Compounding Annual Return6.359%Drawdown17.100%Expectancy0Net Profit0%Sharpe Ratio0.749Loss Rate0%Win Rate0%Profit-Loss Ratio0Alpha0.046Beta0.131Annual Standard Deviation0.071Annual Variance0.005Information Ratio-0.012Tracking Error0.166Treynor Ratio0.405Total Fees\$8.00
```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/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
*/
public class AWP : QCAlgorithm
{
//List<string> _assets = new List<string>() { "OEF", "IJR", "EFA", "EEM", "IEF", "TLT", "DBC", "GLD" };
//List<double> _alloc = new List<double>() { 0.18, 0.03, 0.06, 0.03, 0.15, 0.4, 0.075, 0.075 };

TupleList<double, string> _allocations = new TupleList<double, string>
{
{ 0.18, "OEF" },
{ 0.03, "IJR" },
{ 0.06, "EFA" },
{ 0.03, "EEM" },
{ 0.15, "IEF" },
{ 0.4, "TLT" },
{ 0.075, "DBC" },
{ 0.075, "GLD" }
};

//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{

//Start and End Date range for the backtest:
SetStartDate(2005, 1, 1);
SetEndDate(DateTime.Now.Date.AddDays(-1));

//Cash allocation
SetCash(25000);

foreach (var symbol in _allocations)
{
//Add as many securities as you like. All the data will be passed into the event handler:
AddSecurity(SecurityType.Equity, symbol.Item2, Resolution.Daily);
}
}

//Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
public void OnData(TradeBars data)
{
foreach(var symbol in _allocations)
{
if (!Portfolio[symbol.Item2].HoldStock)
{
if(data.ContainsKey(symbol.Item2))
{
SetHoldings(symbol.Item2,  symbol.Item1);
}
}
}
}

//easify list of symbols and allocations
public class TupleList<T1, T2> : List<Tuple<T1, T2>>
{
public void Add(T1 item, T2 item2)
{
Add( new Tuple<T1, T2>(item, item2));
}
}

}
}```