Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
6.307%
Drawdown
10.700%
Expectancy
0
Net Profit
2.419%
Sharpe Ratio
0.428
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.317
Beta
-12.287
Annual Standard Deviation
0.177
Annual Variance
0.031
Information Ratio
0.318
Tracking Error
0.177
Treynor Ratio
-0.006
Total Fees
$1.87
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 _sym = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);

		MovingAverageConvergenceDivergence _macd;

        /// <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(2018, 1, 1);  //Set Start Date
            SetEndDate(DateTime.Now);    //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(_sym, Resolution.Hour);
            
            _macd = MACD (_sym, 12, 26, 9, MovingAverageType.Exponential, Resolution.Hour);
			PlotIndicator ("MACD Plot", _macd, _macd.Signal, _macd.Histogram);

            // There are other assets with similar methods. See "Selecting Options" etc for more details.
            // AddFuture, AddForex, AddCfd, AddOption
        }

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