public override List <ChanceClass> getChances(CommCollection sc, ExpectData ed) { List <ChanceClass> ret = new List <ChanceClass>(); if (sc == null || sc.Table == null || sc.Table.Rows.Count < this.ReviewExpectCnt) { return(ret); } if (this.getAllStdDev() == null) { this.setAllStdDev(new Dictionary <string, List <double> >()); } double stdval = 0; List <double> list = sc.getAllDistrStdDev(this.ReviewExpectCnt, this.InputMaxTimes); if (!this.getAllStdDev().ContainsKey(ed.Expect)) { stdval = list[10];//最后一位 this.getAllStdDev().Add(ed.Expect, list); } if (getAllStdDev().Count < 20) { return(ret); } MA ma20 = new MA(getAllStdDev().Values.Select(p => p[10]).ToArray(), 20); MA ma5 = new MA(getAllStdDev().Values.Select(p => p[10]).ToArray(), 5); if (!IsTracing) { //if (stdval > 0.2) return ret; if (ma20.IsDownCross())//下穿均线,开始跟踪 { IsTracing = true; } else { return(ret); } } else { ////if (stdval > 0.2) ////{ //// IsTracing = false; //// return ret; ////} if (ma5.IsUpCross())//上穿均线,停止跟踪 { IsTracing = false; return(ret); } } strag_CommOldClass strag = new strag_CommOldClass(); strag.BySer = this.BySer; strag.ChipCount = this.ChipCount; strag.InputMinTimes = this.InputMinTimes; List <ChanceClass> tmp = strag.getChances(sc, ed); Dictionary <string, double> dic = new Dictionary <string, double>(); for (int i = 0; i < 10; i++) { if (list[i] < stdval)//小于整体的才有效 { string strcol = string.Format("{0}", (i + 1) % 10); dic.Add(strcol, list[i]); } } for (int i = 0; i < tmp.Count; i++) { if (dic.ContainsKey(tmp[i].GetCodeKey(this.BySer))) { ret.Add(tmp[i]); } } return(ret); }