Overall Statistics
using NodaTime;

namespace QuantConnect
{
    public class DateTimeEffectAlgo : QCAlgorithm
    {
        /* +-------------------------------------------------+
         * |Algorithm Control Panel                          |
         * +-------------------------------------------------+*/
        private readonly string[] _pairs = {"EURUSD"};
        private readonly decimal _leverage = 1m;
        private readonly decimal _exposure = 1m;
        /* +-------------------------------------------------+*/
        private decimal _shareByPair;
        private readonly List<Symbol> _symbols = new List<Symbol>();


        public override void Initialize()
        {
            SetStartDate(year: 2015, month: 01, day: 01); //Set Start Date
            SetEndDate(year: 2017, month: 09, day: 01); //Set End Date
            SetCash(startingCash: 25000); //Set Strategy Cash
             
            SetBrokerageModel(BrokerageName.OandaBrokerage);

            _shareByPair = (_leverage *_exposure ) / _pairs.Length;

            // Find more symbols here: http://quantconnect.com/data
            foreach (var pair in _pairs)
            {
                _symbols.Add(AddForex(pair, Resolution.Minute, "OANDA", leverage: _leverage).Symbol);
                if (pair == "EURUSD")
                {
                    SetBenchmark(_symbols.Last());
                }
            }


            Schedule.On(DateRules.Every(DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday),
                        TimeRules.At(hour: 9, minute: 15, timeZone: DateTimeZone.Utc),
                        () =>
            {
                foreach (var symbol in _symbols)
                {
                    SetHoldings(symbol, -_shareByPair);
                }
            });

            Schedule.On(DateRules.EveryDay(), TimeRules.At(14, 15, DateTimeZone.Utc), () =>
            {
                foreach (var symbol in _symbols)
                {
                    if (Portfolio[symbol].IsShort)
                    {
                        Liquidate(symbol);
                    }
                }
            });
        }
    }
}