Overall Statistics
Total Trades
508
Average Win
0.31%
Average Loss
-0.38%
Compounding Annual Return
7.142%
Drawdown
6.200%
Expectancy
0.075
Net Profit
7.236%
Sharpe Ratio
1.006
Loss Rate
41%
Win Rate
59%
Profit-Loss Ratio
0.82
Alpha
0.113
Beta
-2.08
Annual Standard Deviation
0.071
Annual Variance
0.005
Information Ratio
0.725
Tracking Error
0.071
Treynor Ratio
-0.034
Total Fees
$0.00
namespace QuantConnect.Algorithm.CSharp
{
    /// <summary>
    /// Basic template algorithm simply initializes the date range and cash. This is a skeleton
    /// framework you can use for designing an algorithm.
    /// </summary>
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
        private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
        
        /// <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(2012, 10, 07);  //Set Start Date
            SetEndDate(2013, 10, 11);    //Set End Date
            SetCash(100000);             //Set Strategy Cash

            // Find more symbols here: http://quantconnect.com/data
            // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
            // Futures Resolution: Tick, Second, Minute
            // Options Resolution: Minute Only.
            AddEquity("SPY", Resolution.Minute);
            Securities[_spy].FeeModel = new ConstantFeeModel(0);
            // There are other assets with similar methods. See "Selecting Options" etc for more details.
            // AddFuture, AddForex, AddCfd, AddOption
            
            
        	Schedule.Event().EveryDay().AfterMarketOpen(_spy, 10).Run(() =>
            {
            	SetHoldings(_spy, 0.9);
            });
        	Schedule.Event().EveryDay().BeforeMarketClose(_spy, 15).Run(() =>
            {
            	SetHoldings(_spy, 0);
            	//Liquidate();
            });
        }

        /// <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, 1);
                //Debug("Purchased Stock");
            }
        }
    }
}