Ejemplo n.º 1
0
        public List<Stock> SelectGold5Fork40()
        {            
            var ret = new List<Stock>();
            foreach (var sinfo in stockInfos)
            {
                var aStock = new Stock(sinfo);

                //取出5点
                var MA5s = aStock.MAForWeek(5);
                var MA40s = aStock.MAForWeek(40);

                //1点
                var ma5 = MA5s.FirstOrDefault();
                var ma40 = MA40s.FirstOrDefault();

                //2点
                var ma5_1 = MA5s.Skip(1).FirstOrDefault();
                var ma40_1 = MA40s.Skip(1).FirstOrDefault();

                if (ma5_1 < ma40_1 && ma5 > ma40)
                    ret.Add(aStock);
            }

            return ret;
        }
Ejemplo n.º 2
0
 public void GetMA5ForWeek()
 {
     var aStock = new Stock(stock603969);
     var val = aStock.MAForWeek(5);
     Assert.AreEqual(13.77m, Math.Round(val[0], 2));
     Assert.AreEqual(15.13M, Math.Round(val[1], 2));
     Assert.AreEqual(16.45m, Math.Round(val[2], 2));
     Assert.AreEqual(17.34m, Math.Round(val[3], 2));
 }
Ejemplo n.º 3
0
 public void GetMa20ForWeek()
 {
     var aStock = new Stock(stock603969);
     var val = aStock.MAForWeek(19);
     Assert.AreEqual(16.56M, Math.Round(val[0], 2));
 }
Ejemplo n.º 4
0
 public void GetMa40ForWeek()
 {
     var aStock = new Stock(stock603969);
     var val = aStock.MAForWeek(40);
     Assert.AreEqual(19.84M, Math.Round(val[0], 2));
     Assert.AreEqual(20.36M, Math.Round(val[1], 2));
     Assert.AreEqual(20.90M, Math.Round(val[2], 2));
     Assert.AreEqual(21.46M, Math.Round(val[3], 2));
     Assert.AreEqual(21.91M, Math.Round(val[4], 2));
 }