                         CGContextStrokeRect(context, _bodyRect)
                     }
                 }
-                else if (e.open < e.close)
+                else if (open < close)
                 {
                     let color = dataSet.increasingColor ?? dataSet.colorAt(j)
                     

                continue
            }
            
            if (showCandleBar)
            {
                // calculate the shadow
                
                _shadowPoints[0].x = CGFloat(e.xIndex)
                _shadowPoints[1].x = CGFloat(e.xIndex)
                _shadowPoints[2].x = CGFloat(e.xIndex)
                _shadowPoints[3].x = CGFloat(e.xIndex)
                
                if (e.open > e.close)
                {
                    _shadowPoints[0].y = CGFloat(e.high) * phaseY
                    _shadowPoints[1].y = CGFloat(e.open) * phaseY
                    _shadowPoints[2].y = CGFloat(e.low) * phaseY
                    _shadowPoints[3].y = CGFloat(e.close) * phaseY
                }
                else if (e.open < e.close)
                {
                    _shadowPoints[0].y = CGFloat(e.high) * phaseY
                    _shadowPoints[1].y = CGFloat(e.close) * phaseY
                    _shadowPoints[2].y = CGFloat(e.low) * phaseY
                    _shadowPoints[3].y = CGFloat(e.open) * phaseY
                }
                else
                {
                    _shadowPoints[0].y = CGFloat(e.high) * phaseY
                    _shadowPoints[1].y = CGFloat(e.open) * phaseY
                    _shadowPoints[2].y = CGFloat(e.low) * phaseY
                    _shadowPoints[3].y = _shadowPoints[1].y
                }
                

                // draw the ranges
                var barColor: UIColor! = nil
                
                if (open > close)
                {
                    barColor = dataSet.decreasingColor ?? dataSet.colorAt(j)
                }
                else if (open < close)
                {
                    barColor = dataSet.increasingColor ?? dataSet.colorAt(j)
                }
