public void DetermineSentimentColorIndex(float bid) { colorCurrent = colorNeutral; if (prevBids.Length > 0) { signCurrent = Math.Sign(bid - prevBids.Last); if (signCurrent != 0) { var sum = prevBids.Sum(pBid => Math.Sign(bid - pBid)); var index = signCurrent == Math.Sign(sum) ? Math.Abs(sum) - 1 : 0; colorCurrent = signCurrent > 0 ? colorsGrowth[index] : colorsFall[index]; } } prevBids.Add(bid); }