Ejemplo n.º 1
0
        private GreenMacdInfoGroup CreteGreenInfoGroup(int index, MacdInfo mInfo, GreenMacdInfoGroup lastGroup)
        {
            //创建组
            var group = new GreenMacdInfoGroup()
            {
                startMInfo = mInfo
            };

            group.lastGroup = lastGroup;//指向上一个group
            return(group);
        }
Ejemplo n.º 2
0
        //遍历分割
        void SepreteToGroupList(MacdInfoList gmlist, Action <MacdInfo, GreenMacdInfoGroup> setGroupAction, bool sum = false)
        {
            int index = 0;
            GreenMacdInfoGroup current   = null;
            MacdInfo           tempMInfo = null;

            foreach (var item in gmlist)
            {
                if (current == null)
                {
                    current = CreteGreenInfoGroup(index, tempMInfo, null);
                }
                //当前与前一个之间有间隔
                else if (tempMInfo.index + 1 < item.index)
                {
                    //计算绿柱面积
                    if (sum)
                    {
                        current.sumVal = current.SumMacd();
                    }
                    index += 1;

                    //创建新组
                    current = CreteGreenInfoGroup(index, tempMInfo, current);
                }
                tempMInfo = item;
                if (setGroupAction != null)
                {
                    setGroupAction(tempMInfo, current);
                }
                current.endMInfo = tempMInfo;
                current.AddByCompare(tempMInfo);
            }
            if (current != null && sum)
            {
                current.sumVal = current.SumMacd();
            }
        }