Overall Statistics
Total Trades
1
Average Win
130.78%
Average Loss
0%
Compounding Annual Return
5.362%
Drawdown
74.500%
Expectancy
0
Net Profit
130.78%
Sharpe Ratio
0.324
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.026
Beta
1.04
Annual Standard Deviation
0.335
Annual Variance
0.112
Information Ratio
0.113
Tracking Error
0.255
Treynor Ratio
0.104
namespace QuantConnect
{
    /// <summary>
    /// QC University algorithm to demonstrate split and dividend events 
    /// </summary>
    public class QCUTotalReturnsAlgorithm : QCAlgorithm
    {
        /// <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(1998, 01, 01);  //Set Start Date
            SetEndDate(2014, 01, 01);    //Set End Date
            SetCash(100000);             //Set Strategy Cash
            // Find more symbols here: http://quantconnect.com/data
            AddSecurity(SecurityType.Equity, "MSFT", Resolution.Minute);
            Securities["MSFT"].SetDataNormalizationMode(DataNormalizationMode.SplitAdjusted);
        }

        /// <summary>
        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// </summary>
        /// <param name="data">TradeBars IDictionary object with your stock data</param>
        public void OnData(TradeBars data)
        {
            if (!Portfolio.Invested)
            {
                SetHoldings("MSFT", .5);
                Debug("Purchased Stock");
            }
        }

        public void OnData(Dividends data) // update this to Dividends dictionary
        {
            var dividend = data["MSFT"];
            Debug(string.Format("{0} >> DIVIDEND >> {1} - {2} - {3} - {4}", dividend.Time.ToString("o"), dividend.Symbol, dividend.Distribution.ToString("C"), Portfolio.Cash, Portfolio["MSFT"].Price.ToString("C")));
        }

        public void OnData(Splits data)
        {
            var split = data["MSFT"];
            Debug(string.Format("{0} >> SPLIT >> {1} - {2} - {3} - {4} - {5}", split.Time.ToString("o"), split.Symbol, split.SplitFactor, Portfolio.Cash, Portfolio["MSFT"].Quantity, Portfolio["MSFT"].Price.ToString("C")));
        }
    }
}