コード例 #1
0
        protected override void OnStart()
        {
            //Print("OnStartUp");

            switch (SeasonalDateType)
            {
            case SeasonalDateType.SellInMay:
                _list_sellinmayandgoaway_buy  = Bars.Where(x => x.Time.Month <= 4 || x.Time.Month >= 10);
                _list_sellinmayandgoaway_sell = Bars.Except(_list_sellinmayandgoaway_buy);
                hashset = new HashSet <DateTime>(_list_sellinmayandgoaway_buy.Select(x => x.Time));
                break;

            case SeasonalDateType.SantaClausRally:
                _list_santaclausrally_buy = from b in Bars
                                            where (b.Time.Month == 12 && b.Time.Day >= 15) || (b.Time.Month == 1 && b.Time.Day <= 9)
                                            select b;
                hashset = new HashSet <DateTime>(_list_santaclausrally_buy.Select(x => x.Time));
                break;

            case SeasonalDateType.fourthofjuly:
                _list_fourthofjuly_buy = from b in Bars
                                         where (b.Time.Month == 7 && b.Time.Day >= 1) || (b.Time.Month == 7 && b.Time.Day <= 8)
                                         select b;
                hashset = new HashSet <DateTime>(_list_fourthofjuly_buy.Select(x => x.Time));
                break;

            case SeasonalDateType.manual:
                _list_manual_buy = from b in Bars
                                   where (b.Time.Month >= this.Start_Month && b.Time.Month <= this.End_Month)
                                   select b;
                hashset = new HashSet <DateTime>(_list_manual_buy.Select(x => x.Time));
                break;

            default:
                break;
            }

            CalculateOnClosedBar = true;
            IsOverlay            = true;
        }
コード例 #2
0
        protected override void OnStartUp()
        {
            //Print("OnStartUp");

            switch (SeasonalType)
            {
            case SeasonalType.SellInMay:
                _list_sellinmayandgoaway_buy  = Bars.Where(x => x.Time.Month <= 4 || x.Time.Month >= 10);
                _list_sellinmayandgoaway_sell = Bars.Except(_list_sellinmayandgoaway_buy);
                hashset = new HashSet <DateTime>(_list_sellinmayandgoaway_buy.Select(x => x.Time));
                break;

            case SeasonalType.SantaClausRally:
                _list_santaclausrally_buy = from b in Bars
                                            where (b.Time.Month == 12 && b.Time.Day >= 15) || (b.Time.Month == 1 && b.Time.Day <= 9)
                                            select b;
                hashset = new HashSet <DateTime>(_list_santaclausrally_buy.Select(x => x.Time));
                break;

            default:
                break;
            }
        }