Overall Statistics
Total Trades
1
Average Win
0.56%
Average Loss
0%
Compounding Annual Return
144.498%
Drawdown
0.400%
Expectancy
0
Net Profit
0.558%
Sharpe Ratio
7.127
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
-0.574
Beta
1.137
Annual Standard Deviation
0.066
Annual Variance
0.004
Information Ratio
-24.846
Tracking Error
0.018
Treynor Ratio
0.412
using System;
using System.Collections;
using System.Collections.Generic; 
using QuantConnect.Securities;  
using QuantConnect.Models;   

namespace QuantConnect 
{   
    // Name your algorithm class anything, as long as it inherits QCAlgorithm
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
        string _symbol = "SPY";
        DateTime _date = new DateTime(2014, 12, 1);
        TradeBars _lastBars = null;
        
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize()
        {
            SetStartDate(2014, 12, 1);
            SetEndDate(2014, 12, 4);
            SetCash(25000);
            AddSecurity(SecurityType.Equity, _symbol, Resolution.Minute);
        }

        //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 (!data.ContainsKey(_symbol)) return;
            if (!Portfolio.Invested) Order(_symbol, 100);
            if (_lastBars == null) _lastBars = data;
            
            if (Time.Date != _date.Date)
            {
                _date = Time;
                Log("PRICES: BarDate>" + _lastBars[_symbol].Time.ToShortDateString() + "> Time> " + _lastBars[_symbol].Time.ToShortTimeString() + " Close > " + _lastBars[_symbol].Close.ToString("C"));
            }
            _lastBars = data;
        }
    }
}