Overall Statistics
namespace QuantConnect
{
    public class ImportPicks : BaseData
	{
        public string ticker1;
        public string ticker2;
        public string ticker3;
        public string ticker4;
        
        public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLive)
        {
            return new SubscriptionDataSource("https://www.dropbox.com/s/kzo2kdu2v7q7qc1/dataforqc.csv?dl=1", SubscriptionTransportMedium.RemoteFile);
        }
        
        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLive)
        {
            ImportPicks importpicks = new ImportPicks();
            string[] data = line.Split(',');
            importpicks.Symbol = config.Symbol;
            importpicks.Time = DateTime.Parse(data[0]).AddHours(0); // Make sure we only get this data AFTER trading day - don't want forward bias.
            importpicks.ticker1 = Convert.ToString(data[1]);
            importpicks.ticker2 = Convert.ToString(data[2]);
            importpicks.ticker3 = Convert.ToString(data[3]);
            importpicks.ticker4 = Convert.ToString(data[4]);
            
            return importpicks;
        }
	}
}
using System;
using System.Collections.Generic;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Data.UniverseSelection;

namespace QuantConnect.Algorithm.CSharp
{
    public class ImportPicksAlgorithm : QCAlgorithm
    {
        private SecurityChanges _changes = SecurityChanges.None;

        //Initialize the data and resolution you require for your strategy:
        public override void Initialize()
        {
            // this is the resolution of securities added by our universe
            UniverseSettings.Resolution = Resolution.Minute;

            SetStartDate(2015, 9, 17);
            SetEndDate(2015, 9, 28);
            SetCash(100 * 1000);

            // this sets our universe based on our custom data type 'ImportPicks'
            AddUniverse<ImportPicks>("import-picks-universe", data =>
            {
            	// 'data' here is IEnumerable<ImportPicks>
            	
                var symbols = new List<string>();
                foreach (var d in data)
                {
                    symbols.Add(d.ticker1);
                    symbols.Add(d.ticker2);
                    symbols.Add(d.ticker3);
                    symbols.Add(d.ticker4);
                }
                
                // these are the universe tickers for today
                return symbols;
            });

            // schedule event to place market on close orders at 15min before market close
            var weekdays = new[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday };
            Schedule.Event("EOD Liquidate").Every(weekdays).At(new TimeSpan(15, 45, 0)).Run(() =>
            {
                // submit market on close orders for all securities that have holdings
                foreach (var security in Securities.Values)
                {
                    if (security.Invested)
                    {
                        MarketOnCloseOrder(security.Symbol, -security.Holdings.Quantity);
                    }
                }
            });
        }

        //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 we have no changes do nothing
            if (_changes == SecurityChanges.None) return;

            // enter each position equally
            foreach (var security in _changes.AddedSecurities)
            {
                SetHoldings(security.Symbol, 0.20m);
            }

            // reset our changes, we'll handle liquidate via a scheduled event/ MOC order
            _changes = SecurityChanges.None;
        }

        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            // save off the changes, these will come in at the time specified in the ImportPicks data
            _changes = changes;
        }
    }
}