| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 28.448% Drawdown 5.300% Expectancy 0 Net Profit 0% Sharpe Ratio 1.675 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.013 Beta 0.932 Annual Standard Deviation 0.106 Annual Variance 0.011 Information Ratio 0.121 Tracking Error 0.012 Treynor Ratio 0.19 Total Fees $1.00 |
using MathNet.Numerics.Statistics;
namespace QuantConnect
{
public class TradingTheOdds : QCAlgorithm
{
SimpleMovingAverage _sma;
string _symbolGSPC = "YAHOO/INDEX_GSPC";
public override void Initialize()
{
// Minimum Start Date: 2011-3-1
SetStartDate(2016, 2, 1);
SetEndDate(2016,8,1);
SetCash(3000);
AddSecurity(SecurityType.Equity, "SPY", Resolution.Daily);
AddData<Quandl>(_symbolGSPC, Resolution.Daily);
}
public override void OnData(Slice data)
{
try
{
var gspc = data.Get<Quandl>(_symbolGSPC);
if (Portfolio["SPY"].HoldStock == false)
{
SetHoldings("SPY", 1.0, true);
Log("Active Pos SPY " + Portfolio["SPY"].Quantity);
}
}
catch (Exception e)
{
Log(e.ToString() + " " + e.Message);
}
}
}
}