Exemplo n.º 1
0
        private void UpdateFans(ChartTrendLine mainFan, ChartTrendLine handleLine, Dictionary <double, ChartTrendLine> fans)
        {
            var endBarIndex = Chart.Bars.GetBarIndex(mainFan.Time2, Chart.Symbol);

            var barsDelta  = handleLine.GetBarsNumber(Chart.Bars, Chart.Symbol) / 2;
            var priceDelta = handleLine.GetPriceDelta() / 2;

            var slope = handleLine.GetSlope();

            foreach (var fan in fans)
            {
                var fanSettings = SideFanSettings.FirstOrDefault(iSettings => iSettings.Percent == fan.Key);

                if (fanSettings == null)
                {
                    continue;
                }

                var secondBarIndex = slope > 0 ? endBarIndex + barsDelta * fanSettings.Percent : endBarIndex - barsDelta * fanSettings.Percent;

                var secondTime = Chart.Bars.GetOpenTime(secondBarIndex, Chart.Symbol);

                var secondPrice = mainFan.Y2 + priceDelta * fanSettings.Percent;

                var fanLine = fan.Value;

                fanLine.Time1 = mainFan.Time1;
                fanLine.Time2 = secondTime;

                fanLine.Y1 = mainFan.Y1;
                fanLine.Y2 = secondPrice;
            }
        }
Exemplo n.º 2
0
        public static void RefelectOnOtherLine(this ChartTrendLine line, ChartTrendLine otherLine, Bars bars, Symbol symbol)
        {
            var onePercentFirstBarIndex = bars.GetBarIndex(otherLine.Time1, symbol);

            var zeroLineBarsDelta  = line.GetBarsNumber(bars, symbol);
            var zeroLinePriceDelta = line.GetPriceDelta();

            var zeroLineSlope = line.GetSlope();

            double secondBarIndex, secondPrice;

            if (line.Time1 < line.Time2)
            {
                secondBarIndex = onePercentFirstBarIndex + zeroLineBarsDelta;
                secondPrice    = zeroLineSlope > 0 ? otherLine.Y1 + zeroLinePriceDelta : otherLine.Y1 - zeroLinePriceDelta;
            }
            else
            {
                secondBarIndex = onePercentFirstBarIndex - zeroLineBarsDelta;
                secondPrice    = zeroLineSlope > 0 ? otherLine.Y1 - zeroLinePriceDelta : otherLine.Y1 + zeroLinePriceDelta;
            }

            otherLine.Time2 = bars.GetOpenTime(secondBarIndex, symbol);
            otherLine.Y2    = secondPrice;
        }
Exemplo n.º 3
0
        private void UpdateMedianLine(ChartTrendLine medianLine, ChartTrendLine handleLine)
        {
            var handleLineStartBarIndex = handleLine.GetStartBarIndex(Chart.Bars, Chart.Symbol);
            var handleLineBarsNumber    = handleLine.GetBarsNumber(Chart.Bars, Chart.Symbol);

            medianLine.Time2 = Chart.Bars.GetOpenTime(handleLineStartBarIndex + handleLineBarsNumber / 2, Chart.Symbol);
            medianLine.Y2    = handleLine.GetBottomPrice() + handleLine.GetPriceDelta() / 2;
        }
Exemplo n.º 4
0
        private void DrawOrUpdateExtendedSideLines(ChartTrendLine mainFanLine, ref ChartTrendLine horizontalLine, ref ChartTrendLine verticalLine)
        {
            if (mainFanLine == null)
            {
                return;
            }

            var time1 = mainFanLine.Time1;
            var time2 = mainFanLine.Time2;

            var y1 = mainFanLine.Y1;
            var y2 = mainFanLine.Y2;

            var timeDelta = mainFanLine.GetTimeDelta();

            var horizontalLineTime2 = time2 > time1?time2.Add(timeDelta) : time2.Add(-timeDelta);

            if (horizontalLine == null)
            {
                var name = GetObjectName("HorizontalExtendedLine");

                horizontalLine = Chart.DrawTrendLine(name, time1, y1, horizontalLineTime2, y1, _settings.ExtendedLinesColor, _settings.ExtendedLinesThickness, _settings.ExtendedLinesStyle);

                horizontalLine.IsInteractive    = true;
                horizontalLine.IsLocked         = true;
                horizontalLine.ExtendToInfinity = true;
            }
            else
            {
                horizontalLine.Time1 = time1;
                horizontalLine.Time2 = horizontalLineTime2;
                horizontalLine.Y1    = y1;
                horizontalLine.Y2    = y1;
            }

            var priceDelta = mainFanLine.GetPriceDelta();

            var verticalLineY2 = y2 > y1 ? y2 + priceDelta : y2 - priceDelta;

            if (verticalLine == null)
            {
                var name = GetObjectName("VerticalExtendedLine");

                verticalLine = Chart.DrawTrendLine(name, time1, y1, time1, verticalLineY2, _settings.ExtendedLinesColor, _settings.ExtendedLinesThickness, _settings.ExtendedLinesStyle);

                verticalLine.IsInteractive    = true;
                verticalLine.IsLocked         = true;
                verticalLine.ExtendToInfinity = true;
            }
            else
            {
                verticalLine.Time1 = time1;
                verticalLine.Time2 = time1;
                verticalLine.Y1    = y1;
                verticalLine.Y2    = verticalLineY2;
            }
        }
Exemplo n.º 5
0
        private void UpdateMainFan(ChartTrendLine handleLine, ChartTrendLine mainFan)
        {
            var handleLineBarsNumber = handleLine.GetBarsNumber(Chart.Bars, Chart.Symbol);

            var mainFanLineSecondBarIndex = handleLine.GetStartBarIndex(Chart.Bars, Chart.Symbol) + handleLineBarsNumber / 2;

            mainFan.Time2 = Chart.Bars.GetOpenTime(mainFanLineSecondBarIndex, Chart.Symbol);
            mainFan.Y2    = handleLine.GetBottomPrice() + handleLine.GetPriceDelta() / 2;
        }
        private void DrawLevels(ChartTrendLine mainLine)
        {
            var verticalDelta = mainLine.GetPriceDelta();

            var previousLevelPrice = double.NaN;

            FibonacciLevel previousLevel = null;

            var startTime = mainLine.GetStartTime();
            var endTime   = mainLine.GetEndTime();

            foreach (var level in _levels)
            {
                var levelAmount = level.Percent == 0 ? 0 : verticalDelta * level.Percent;

                var levelLineName = GetObjectName(string.Format("LevelLine_{0}", level.Percent));

                var price = mainLine.Y2 > mainLine.Y1 ? mainLine.Y2 - levelAmount : mainLine.Y2 + levelAmount;

                var lineColor = level.IsFilled ? level.LineColor : level.FillColor;

                var levelLine = Chart.DrawTrendLine(levelLineName, startTime, price, endTime, price, lineColor, level.Thickness, level.Style);

                levelLine.IsInteractive    = true;
                levelLine.IsLocked         = true;
                levelLine.ExtendToInfinity = level.ExtendToInfinity;

                _levelLines[level.Percent] = levelLine;

                if (previousLevel == null)
                {
                    previousLevelPrice = price;

                    previousLevel = level;

                    continue;
                }

                var levelRectangleName = GetObjectName(string.Format("LevelRectangle_{0}", level.Percent));

                var rectangle = Chart.DrawRectangle(levelRectangleName, startTime, previousLevelPrice, endTime, price, level.FillColor, 0);

                rectangle.IsFilled = level.IsFilled;

                rectangle.IsInteractive = true;
                rectangle.IsLocked      = true;

                if (level.ExtendToInfinity)
                {
                    rectangle.Time2 = rectangle.Time2.AddMonths(100);
                }

                previousLevelPrice = price;
                previousLevel      = level;
            }
        }
Exemplo n.º 7
0
        protected override void OnMouseMove(ChartMouseEventArgs obj)
        {
            if (MouseUpNumber < 2 || _handleLine == null)
            {
                base.OnMouseMove(obj);

                return;
            }

            _handleLine.Time2 = obj.TimeValue;
            _handleLine.Y2    = obj.YValue;

            var handleLineBarsNumber = _handleLine.GetBarsNumber(Chart.Bars, Chart.Symbol);

            var mainFanLineSecondBarIndex = _handleLine.GetStartBarIndex(Chart.Bars, Chart.Symbol) + handleLineBarsNumber / 2;

            MainFanLine.Time2 = Chart.Bars.GetOpenTime(mainFanLineSecondBarIndex, Chart.Symbol);
            MainFanLine.Y2    = _handleLine.GetBottomPrice() + _handleLine.GetPriceDelta() / 2;

            DrawSideFans(MainFanLine);
        }
Exemplo n.º 8
0
        protected virtual void UpdateSideFans(ChartTrendLine mainFan, Dictionary <double, ChartTrendLine> sideFans)
        {
            var startBarIndex = mainFan.GetStartBarIndex(Chart.Bars, Chart.Symbol);
            var endBarIndex   = mainFan.GetEndBarIndex(Chart.Bars, Chart.Symbol);

            var barsNumber = mainFan.GetBarsNumber(Chart.Bars, Chart.Symbol);

            var mainFanPriceDelta = mainFan.GetPriceDelta();

            for (var iFan = 0; iFan < SideFanSettings.Length; iFan++)
            {
                var fanSettings = SideFanSettings[iFan];

                double   y2;
                DateTime time2;

                if (fanSettings.Percent < 0)
                {
                    var yAmount = mainFanPriceDelta * Math.Abs(fanSettings.Percent);

                    y2 = mainFan.Y2 > mainFan.Y1 ? mainFan.Y2 - yAmount : mainFan.Y2 + yAmount;

                    time2 = mainFan.Time2;
                }
                else
                {
                    y2 = mainFan.Y2;

                    var barsPercent = barsNumber * fanSettings.Percent;

                    var barIndex = mainFan.Time2 > mainFan.Time1 ? endBarIndex - barsPercent : startBarIndex + barsPercent;

                    time2 = Chart.Bars.GetOpenTime(barIndex, Chart.Symbol);
                }

                ChartTrendLine fanLine;

                if (!sideFans.TryGetValue(fanSettings.Percent, out fanLine))
                {
                    continue;
                }

                fanLine.Time1 = mainFan.Time1;
                fanLine.Time2 = time2;

                fanLine.Y1 = mainFan.Y1;
                fanLine.Y2 = y2;
            }
        }
Exemplo n.º 9
0
        private void DrawPercentLevels(ChartTrendLine medianLine, ChartTrendLine handleLine, long id)
        {
            var medianLineSecondBarIndex = Chart.Bars.GetBarIndex(medianLine.Time2, Chart.Symbol);
            var handleLineFirstBarIndex  = Chart.Bars.GetBarIndex(handleLine.Time1, Chart.Symbol);

            var barsDelta       = Math.Abs(medianLineSecondBarIndex - handleLineFirstBarIndex);
            var lengthInMinutes = Math.Abs((medianLine.Time2 - handleLine.Time1).TotalMinutes) * 2;
            var priceDelta      = handleLine.GetPriceDelta() / 2;

            var handleLineSlope = handleLine.GetSlope();

            foreach (var levelSettings in _levelsSettings)
            {
                DrawLevel(medianLine, medianLineSecondBarIndex, barsDelta, lengthInMinutes, priceDelta, handleLineSlope, levelSettings.Value.Percent, levelSettings.Value.LineColor, id);
                DrawLevel(medianLine, medianLineSecondBarIndex, barsDelta, lengthInMinutes, priceDelta, handleLineSlope, -levelSettings.Value.Percent, levelSettings.Value.LineColor, id);
            }
        }
Exemplo n.º 10
0
        protected virtual void DrawSideFans(ChartTrendLine mainFan)
        {
            var startBarIndex = mainFan.GetStartBarIndex(Chart.Bars, Chart.Symbol);
            var endBarIndex   = mainFan.GetEndBarIndex(Chart.Bars, Chart.Symbol);

            var barsNumber = mainFan.GetBarsNumber(Chart.Bars, Chart.Symbol);

            var mainFanPriceDelta = mainFan.GetPriceDelta();

            for (var iFan = 0; iFan < SideFanSettings.Length; iFan++)
            {
                var fanSettings = SideFanSettings[iFan];

                double   y2;
                DateTime time2;

                if (fanSettings.Percent < 0)
                {
                    var yAmount = mainFanPriceDelta * Math.Abs(fanSettings.Percent);

                    y2 = mainFan.Y2 > mainFan.Y1 ? mainFan.Y2 - yAmount : mainFan.Y2 + yAmount;

                    time2 = mainFan.Time2;
                }
                else
                {
                    y2 = mainFan.Y2;

                    var barsPercent = barsNumber * fanSettings.Percent;

                    var barIndex = mainFan.Time2 > mainFan.Time1 ? endBarIndex - barsPercent : startBarIndex + barsPercent;

                    time2 = Chart.Bars.GetOpenTime(barIndex, Chart.Symbol);
                }

                var objectName = GetObjectName(string.Format("SideFan_{0}", fanSettings.Percent));

                var trendLine = Chart.DrawTrendLine(objectName, mainFan.Time1, mainFan.Y1, time2, y2, fanSettings.Color, fanSettings.Thickness, fanSettings.Style);

                trendLine.IsInteractive    = true;
                trendLine.IsLocked         = true;
                trendLine.ExtendToInfinity = true;

                SideFanLines[fanSettings.Percent] = trendLine;
            }
        }
Exemplo n.º 11
0
        private void DrawOrUpdateHorizontalLines(ChartTrendLine mainFan, Dictionary <double, ChartTrendLine> horizontalLines)
        {
            var startTime = mainFan.GetStartTime();
            var endTime   = mainFan.GetEndTime();

            var verticalDelta = mainFan.GetPriceDelta();

            for (int i = 0; i < _settings.SideFanSettings.Length; i++)
            {
                var fanSettings = _settings.SideFanSettings[i];

                if (fanSettings.Percent > 0)
                {
                    continue;
                }

                var absolutePercent = Math.Abs(fanSettings.Percent);

                var lineLevel = absolutePercent * verticalDelta;

                var level = mainFan.Y2 > mainFan.Y1 ? mainFan.Y2 - lineLevel : mainFan.Y2 + lineLevel;

                ChartTrendLine line;

                if (horizontalLines.TryGetValue(absolutePercent, out line))
                {
                    line.Time1 = startTime;
                    line.Time2 = endTime;

                    line.Y1 = level;
                    line.Y2 = level;
                }
                else if (_settings.ShowPriceLevels)
                {
                    var objectName = GetObjectName(string.Format("HorizontalLine_{0}", absolutePercent.ToString(CultureInfo.InvariantCulture)));

                    line = Chart.DrawTrendLine(objectName, startTime, level, endTime, level, _settings.PriceLevelsColor, _settings.PriceLevelsThickness, _settings.PriceLevelsStyle);

                    line.IsInteractive = true;
                    line.IsLocked      = true;

                    horizontalLines.Add(absolutePercent, line);
                }
            }
        }
Exemplo n.º 12
0
        private void UpdateHandleLine(ChartTrendLine handleLine, ChartTrendLine mainFan)
        {
            var mainFanSecondBarIndex    = Chart.Bars.GetBarIndex(mainFan.Time2, Chart.Symbol);
            var handleLineHalfBarsNumber = handleLine.GetBarsNumber(Chart.Bars, Chart.Symbol) / 2;

            var firstBarIndex  = mainFanSecondBarIndex - handleLineHalfBarsNumber;
            var secondBarIndex = mainFanSecondBarIndex + handleLineHalfBarsNumber;

            handleLine.Time1 = Chart.Bars.GetOpenTime(firstBarIndex, Chart.Symbol);
            handleLine.Time2 = Chart.Bars.GetOpenTime(secondBarIndex, Chart.Symbol);

            var handleLineHalfPriceDelta = handleLine.GetPriceDelta() / 2;

            var handleLineSlope = handleLine.GetSlope();

            handleLine.Y1 = handleLineSlope > 0 ? mainFan.Y2 - handleLineHalfPriceDelta : mainFan.Y2 + handleLineHalfPriceDelta;
            handleLine.Y2 = handleLineSlope > 0 ? mainFan.Y2 + handleLineHalfPriceDelta : mainFan.Y2 - handleLineHalfPriceDelta;
        }
        protected override void OnMouseMove(ChartMouseEventArgs obj)
        {
            if (MouseUpNumber == 1)
            {
                _zeroLine.Time2 = obj.TimeValue;
                _zeroLine.Y2    = obj.YValue;
            }
            else if (MouseUpNumber == 2 && _zeroLine != null)
            {
                var onePercentLineName = GetObjectName("OnePercentLine");

                var onePercentFirstBarIndex = Chart.Bars.GetBarIndex(obj.TimeValue, Chart.Symbol);

                var zeroLineBarsDelta  = _zeroLine.GetBarsNumber(Chart.Bars, Chart.Symbol);
                var zeroLinePriceDelta = _zeroLine.GetPriceDelta();

                var zeroLineSlope = _zeroLine.GetSlope();

                double secondBarIndex, secondPrice;

                if (_zeroLine.Time1 < _zeroLine.Time2)
                {
                    secondBarIndex = onePercentFirstBarIndex + zeroLineBarsDelta;
                    secondPrice    = zeroLineSlope > 0 ? obj.YValue + zeroLinePriceDelta : obj.YValue - zeroLinePriceDelta;
                }
                else
                {
                    secondBarIndex = onePercentFirstBarIndex - zeroLineBarsDelta;
                    secondPrice    = zeroLineSlope > 0 ? obj.YValue - zeroLinePriceDelta : obj.YValue + zeroLinePriceDelta;
                }

                _onePercentLine = Chart.DrawTrendLine(onePercentLineName, obj.TimeValue, obj.YValue, Chart.Bars.GetOpenTime(secondBarIndex, Chart.Symbol), secondPrice, Color, 1, LineStyle.Dots);

                _onePercentLine.IsInteractive = true;

                var levellines = DrawFibonacciLevels(_zeroLine, _onePercentLine, zeroLineSlope, Id);

                foreach (var levelLine in levellines)
                {
                    _otherLevelLines[levelLine.Key] = levelLine.Value;
                }
            }
        }
        private void UpdatePattern(ChartTrendLine mainLine, IOrderedEnumerable <KeyValuePair <double, ChartTrendLine> > levelLines, Dictionary <double, ChartRectangle> levelRectangles, ChartObject updatedChartObject)
        {
            var verticalDelta = mainLine.GetPriceDelta();

            var previousLevelPrice = double.NaN;

            FibonacciLevel previousLevel = null;

            var startTime = mainLine.GetStartTime();
            var endTime   = mainLine.GetEndTime();

            foreach (var levelLine in levelLines)
            {
                var percent = levelLine.Key;

                var level = _levels.FirstOrDefault(iLevel => iLevel.Percent == percent);

                if (level == null)
                {
                    continue;
                }

                var levelAmount = percent == 0 ? 0 : verticalDelta * percent;

                var price = mainLine.Y2 > mainLine.Y1 ? mainLine.Y2 - levelAmount : mainLine.Y2 + levelAmount;

                levelLine.Value.Time1 = startTime;
                levelLine.Value.Time2 = endTime;

                levelLine.Value.Y1 = price;
                levelLine.Value.Y2 = price;

                if (previousLevel == null)
                {
                    previousLevelPrice = price;

                    previousLevel = level;

                    continue;
                }

                ChartRectangle levelRectangle;

                if (levelRectangles.TryGetValue(level.Percent, out levelRectangle))
                {
                    if (levelLine.Value == updatedChartObject)
                    {
                        levelRectangle.Color = Color.FromArgb(level.FillColor.A, levelLine.Value.Color);
                    }
                    else if (levelRectangle == updatedChartObject)
                    {
                        levelLine.Value.Color = Color.FromArgb(level.LineColor.A, levelRectangle.Color);
                    }
                }

                ChartRectangle previousLevelRectangle;

                if (!levelRectangles.TryGetValue(previousLevel.Percent, out previousLevelRectangle))
                {
                    continue;
                }

                previousLevelRectangle.Time1 = startTime;

                previousLevelRectangle.Time2 = previousLevel.ExtendToInfinity ? endTime.AddMonths(100) : endTime;

                previousLevelRectangle.Y1 = previousLevelPrice;
                previousLevelRectangle.Y2 = price;

                previousLevelPrice = price;
                previousLevel      = level;
            }
        }
        private Dictionary <double, ChartTrendLine> DrawFibonacciLevels(ChartTrendLine zeroLine, ChartTrendLine onePercentLine, double zeroLineSlope, long id, bool updateMainLineStlyes = true)
        {
            var zeroFirstBarIndex  = Chart.Bars.GetBarIndex(zeroLine.Time1, Chart.Symbol);
            var zeroSecondBarIndex = Chart.Bars.GetBarIndex(zeroLine.Time2, Chart.Symbol);

            var onePercentFirstBarIndex = Chart.Bars.GetBarIndex(onePercentLine.Time1, Chart.Symbol);

            var barsDelta  = Math.Abs(zeroFirstBarIndex - onePercentFirstBarIndex);
            var priceDelta = Math.Abs(zeroLine.Y1 - onePercentLine.Y1);

            var zeroLineBarsDelta  = zeroLine.GetBarsNumber(Chart.Bars, Chart.Symbol);
            var zeroLinePriceDelta = zeroLine.GetPriceDelta();

            var result = new Dictionary <double, ChartTrendLine>();

            foreach (var level in _fibonacciLevels)
            {
                if (level.Percent == 0 && updateMainLineStlyes)
                {
                    zeroLine.Color     = level.LineColor;
                    zeroLine.Thickness = level.Thickness;
                    zeroLine.LineStyle = level.Style;
                }
                else if (level.Percent == 1 && updateMainLineStlyes)
                {
                    onePercentLine.Color     = level.LineColor;
                    onePercentLine.Thickness = level.Thickness;
                    onePercentLine.LineStyle = level.Style;
                }
                else
                {
                    var levelName = GetObjectName(string.Format("Level_{0}", level.Percent.ToString(CultureInfo.InvariantCulture)), id);

                    var barsAmount  = barsDelta * level.Percent;
                    var priceAmount = priceDelta * level.Percent;

                    double firstBarIndex, secondBarIndex, firstPrice, secondPrice;

                    if (onePercentLine.Time1 < zeroLine.Time1)
                    {
                        firstPrice = onePercentLine.Y1 > zeroLine.Y1 ? zeroLine.Y1 + priceAmount : zeroLine.Y1 - priceAmount;

                        if (zeroLine.Time1 < zeroLine.Time2)
                        {
                            firstBarIndex  = zeroFirstBarIndex - barsAmount;
                            secondBarIndex = firstBarIndex + zeroLineBarsDelta;

                            secondPrice = zeroLineSlope > 0 ? firstPrice + zeroLinePriceDelta : firstPrice - zeroLinePriceDelta;
                        }
                        else
                        {
                            firstBarIndex  = zeroFirstBarIndex - barsAmount;
                            secondBarIndex = firstBarIndex - zeroLineBarsDelta;

                            secondPrice = zeroLineSlope > 0 ? firstPrice - zeroLinePriceDelta : firstPrice + zeroLinePriceDelta;
                        }
                    }
                    else
                    {
                        firstPrice = onePercentLine.Y1 > zeroLine.Y1 ? zeroLine.Y1 + priceAmount : zeroLine.Y1 - priceAmount;

                        if (zeroLine.Time1 < zeroLine.Time2)
                        {
                            firstBarIndex  = zeroFirstBarIndex + barsAmount;
                            secondBarIndex = firstBarIndex + zeroLineBarsDelta;

                            secondPrice = zeroLineSlope > 0 ? firstPrice + zeroLinePriceDelta : firstPrice - zeroLinePriceDelta;
                        }
                        else
                        {
                            firstBarIndex  = zeroFirstBarIndex + barsAmount;
                            secondBarIndex = firstBarIndex - zeroLineBarsDelta;

                            secondPrice = zeroLineSlope > 0 ? firstPrice - zeroLinePriceDelta : firstPrice + zeroLinePriceDelta;
                        }
                    }

                    var firstTime  = Chart.Bars.GetOpenTime(firstBarIndex, Chart.Symbol);
                    var secondTime = Chart.Bars.GetOpenTime(secondBarIndex, Chart.Symbol);

                    var levelLine = Chart.Objects.FirstOrDefault(iObject => iObject.Name.Equals(levelName, StringComparison.OrdinalIgnoreCase)) as ChartTrendLine;

                    if (levelLine != null)
                    {
                        levelLine.Time1 = firstTime;
                        levelLine.Time2 = secondTime;

                        levelLine.Y1 = firstPrice;
                        levelLine.Y2 = secondPrice;
                    }
                    else
                    {
                        levelLine = Chart.DrawTrendLine(levelName, firstTime, firstPrice, secondTime, secondPrice, level.LineColor, level.Thickness, level.Style);
                    }

                    levelLine.IsInteractive = true;
                    levelLine.IsLocked      = true;

                    result.Add(level.Percent, levelLine);
                }
            }

            return(result);
        }