示例#1
0
        private int[] ArrangeOrderNumbers()
        {
            var ordNumbers = new int[orders];
            int index      = 0;

            for (int wayPoint = 0; wayPoint < StatsBuffer.WayPoints(selectedBar); wayPoint++)
            {
                int          ordNumb = StatsBuffer.WayPoint(selectedBar, wayPoint).OrdNumb;
                WayPointType wpType  = StatsBuffer.WayPoint(selectedBar, wayPoint).WpType;

                if (ordNumb == -1)
                {
                    continue;                // There is no order
                }
                if (ordNumb < StatsBuffer.OrdNumb(selectedBar, 0))
                {
                    continue;                                                // For a transferred position
                }
                if (wpType == WayPointType.Add || wpType == WayPointType.Cancel ||
                    wpType == WayPointType.Entry || wpType == WayPointType.Exit ||
                    wpType == WayPointType.Reduce || wpType == WayPointType.Reverse)
                {
                    ordNumbers[index] = ordNumb;
                    index++;
                }
            }

            for (int ord = 0; ord < orders; ord++)
            {
                int  ordNumb    = StatsBuffer.OrdNumb(selectedBar, ord);
                bool toIncluded = true;
                for (int i = 0; i < index; i++)
                {
                    if (ordNumb != ordNumbers[i])
                    {
                        continue;
                    }
                    toIncluded = false;
                    break;
                }
                if (!toIncluded)
                {
                    continue;
                }
                ordNumbers[index] = ordNumb;
                index++;
            }

            return(ordNumbers);
        }