| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 21.705% Drawdown 7.400% Expectancy 0 Net Profit 0% Sharpe Ratio 1.795 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.213 Beta -0.059 Annual Standard Deviation 0.112 Annual Variance 0.013 Information Ratio -0.069 Tracking Error 0.162 Treynor Ratio -3.397 Total Fees $1.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 BasicTemplateAlgorithm : QCAlgorithm
{
//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
SetStartDate(2013, 1, 1);
SetEndDate(2015, 1, 1);
SetCash(25000);
AddSecurity(SecurityType.Equity, "SPY", Resolution.Daily);
var price = Identity("SPY");
var fast = EMA("SPY", 7);
var slow = EMA("SPY", 14);
PlotIndicator("SPY", price, fast, slow);
}
//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)
{
if (!Portfolio.HoldStock)
{
SetHoldings("SPY", 1.0);
}
}
}
}