I notice this section in the code, that leaves me a bit confused.
// cap it end->start points[pointIdx].X = chartControl.GetXByBarIndex(chartBars, endIdx + Displacement); points[[COLOR="red"]pointIdx++[/COLOR]].Y = chartScale.GetYByValue(Math.Max(chartScale.MinValue, Math.Min(chartScale.MaxValue, Price))); points[[COLOR="red"]pointIdx[/COLOR]].X = chartControl.GetXByBarIndex(chartBars, startIdx + Displacement); points[pointIdx++].Y = chartScale.GetYByValue(Math.Max(chartScale.MinValue, Math.Min(chartScale.MaxValue, Price)));
Notice that the third line of code merely replaces the self-same points[pointIdx] calculated off of endIdx, with one calculated off of startIdx; and the fourth line of code is an exact duplicate of the second line of code. It seems strange to be immediately replacing code that has not been used, then writing the exact same code for another quantity that has not been used either.
Did you intend to write,
// cap it end->start points[pointIdx].X = chartControl.GetXByBarIndex(chartBars, endIdx + Displacement); points[[COLOR="Red"]pointIdx[/COLOR]].Y = chartScale.GetYByValue(Math.Max(chartScale.MinValue, Math.Min(chartScale.MaxValue, Price))); points[[COLOR="red"]pointIdx++[/COLOR]].X = chartControl.GetXByBarIndex(chartBars, startIdx + Displacement); points[pointIdx++].Y = chartScale.GetYByValue(Math.Max(chartScale.MinValue, Math.Min(chartScale.MaxValue, Price)));
Comment