Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
using System;
using System.Globalization;
using QuantConnect.Data;
using QuantConnect.Data.Market;

namespace QuantConnect.Algorithm.CSharp.My_Algorithms
{
    public class ES5minData : TradeBar
    {
        public decimal UpperShadow { get; set; }
        public decimal LowerShadow { get; set; }
        public decimal HighLow { get; set; }
        public decimal RealBody { get; set; }
        public decimal UpperShadowPercent { get; set; }
        public decimal LowerShadowPercent { get; set; }

        public override DateTime EndTime
        {
            get { return (Time + Period); }
            set { Time = (value - Period); }
        }

        public new TimeSpan Period
        {
            get { return TimeSpan.FromMinutes(5); }
        }

        public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
        {
            return new SubscriptionDataSource("https://www.dropbox.com/s/5u4jw1k4bm5gr8y/ES%202015-01-02%20-%202015-12-31%20-%20EST.csv?dl=1",
               /* "https://www.dropbox.com/s/2til1kzb6s4snpw/ES%202016-01-04%20-%202016-12-30%20-%20EST.csv?dl=1",*/ SubscriptionTransportMedium.RemoteFile);
        }

        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
        {
            ES5minData cmBar = new ES5minData();

            try
            {
                var data = line.Split(',');
                //Required.
                cmBar.Symbol = "ES";

                if (data[1].Length == 5)
                {
                    var theDate = DateTime.ParseExact(data[0], "yyyyMMdd", CultureInfo.InvariantCulture);
                    var theTime = TimeSpan.ParseExact(data[1].Insert(0, "0"), "hhmmss", CultureInfo.InvariantCulture);
                    cmBar.Time = theDate + theTime;
                }
                else
                {
                    var theDate = DateTime.ParseExact(data[0], "yyyyMMdd", CultureInfo.InvariantCulture);
                    var theTime = TimeSpan.ParseExact(data[1], "hhmmss", CultureInfo.InvariantCulture);
                    cmBar.Time = theDate + theTime;
                }

                cmBar.Open = Convert.ToDecimal(data[2], CultureInfo.InvariantCulture);
                cmBar.High = Convert.ToDecimal(data[3], CultureInfo.InvariantCulture);
                cmBar.Low = Convert.ToDecimal(data[4], CultureInfo.InvariantCulture);
                cmBar.Close = Convert.ToDecimal(data[5], CultureInfo.InvariantCulture);
                cmBar.Volume = Convert.ToInt64(data[6], CultureInfo.InvariantCulture);

                cmBar.Value = cmBar.Close;

                if (cmBar.Close > cmBar.Open)
                {
                    cmBar.UpperShadow = (cmBar.High - cmBar.Close);
                    cmBar.LowerShadow = (cmBar.Open - cmBar.Low);
                    cmBar.RealBody = (cmBar.Close - cmBar.Open);
                }
                else
                {
                    cmBar.UpperShadow = (cmBar.High - cmBar.Open);
                    cmBar.LowerShadow = (cmBar.Close - cmBar.Low);
                    cmBar.RealBody = (cmBar.Open - cmBar.Close);
                }
                cmBar.HighLow = (cmBar.High - cmBar.Low);

                cmBar.UpperShadowPercent = (cmBar.UpperShadow / cmBar.HighLow * 100);
                cmBar.LowerShadowPercent = (cmBar.LowerShadow / cmBar.HighLow * 100);
            }
            catch
            {

            }
            return cmBar;
        }
    }
}                        
using System;
using QuantConnect.Indicators;
using System.Collections.Generic;
using System.Linq;

namespace QuantConnect.Algorithm.CSharp.My_Algorithms
{
    public class Intraday5minDayHighAndLow : QCAlgorithm
    {
        private string _symbol = "ES";        
        private List<DailyBar> _dailyBars = new List<DailyBar>();      

        public override void Initialize()
        {
            SetStartDate(2015, 08, 24);  //Set Start Date
            SetEndDate(2015, 08, 24);    //Set End Date
            SetCash(100000);             //Set Strategy Cash

            AddData<ES5minData>(_symbol);  

            _dailyBars.Add(new DailyBar(_symbol,
                Identity(_symbol, Resolution.Daily, Field.Open),
                Identity(_symbol, Resolution.Daily, Field.High),
                Identity(_symbol, Resolution.Daily, Field.Low),
                Identity(_symbol, Resolution.Daily, Field.Close)));
        }

        public void OnData(ES5minData data)
        {
            if (data.Time.TimeOfDay < new TimeSpan(9, 30, 00) ||
                data.Time.TimeOfDay > new TimeSpan(12, 00, 00))
                return;              

            Debug(Environment.NewLine + string.Join(Environment.NewLine, _dailyBars.Select(x => x.ToString())));
        }
    }

    public class DailyBar
        {
            private Identity _open;
            private Identity _high;
            private Identity _low;
            private Identity _close;
            public Symbol Symbol { get; private set; }
            public decimal Open { get { return _open; } }
            public decimal High { get { return _high; } }
            public decimal Low { get { return _low; } }
            public decimal Close { get { return _close; } }
            public DateTime EndTime { get { return IsReady ? _close.Current.EndTime : DateTime.MaxValue; } }
            
            public bool IsReady { get { return _close.IsReady; } }

            public DailyBar(Symbol _symbol, Identity open, Identity high, Identity low, Identity close)
            {
                Symbol = _symbol;
                _open = open;
                _high = high;
                _low = low;
                _close = close;
            }

            public override string ToString()
            {
                return IsReady
                    ? string.Format("{0} {1} -> O: {2:0.00} H: {3:0.00} L: {4:0.00} C: {5:0.00}", EndTime, Symbol, Open, High, Low, Close)
                    : Symbol.ID + " is not ready";
            }
        }
}