                 continue
             }
             
+            let xIndex = e.xIndex
+            let open = e.open
+            let close = e.close
+            let high = e.high
+            let low = e.low
+            
             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
+                _shadowPoints[0].x = CGFloat(xIndex)
+                _shadowPoints[1].x = CGFloat(xIndex)
+                _shadowPoints[2].x = CGFloat(xIndex)
+                _shadowPoints[3].x = CGFloat(xIndex)
+                
+                if (open > close)
+                {
+                    _shadowPoints[0].y = CGFloat(high) * phaseY
+                    _shadowPoints[1].y = CGFloat(open) * phaseY
+                    _shadowPoints[2].y = CGFloat(low) * phaseY
+                    _shadowPoints[3].y = CGFloat(close) * phaseY
+                }
+                else if (open < close)
+                {
+                    _shadowPoints[0].y = CGFloat(high) * phaseY
+                    _shadowPoints[1].y = CGFloat(close) * phaseY
+                    _shadowPoints[2].y = CGFloat(low) * phaseY
+                    _shadowPoints[3].y = CGFloat(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[0].y = CGFloat(high) * phaseY
+                    _shadowPoints[1].y = CGFloat(open) * phaseY
+                    _shadowPoints[2].y = CGFloat(low) * phaseY
                     _shadowPoints[3].y = _shadowPoints[1].y
                 }
                 

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

            }
            else
            {
                _rangePoints[0].x = CGFloat(xIndex)
                _rangePoints[0].y = CGFloat(high) * phaseY
                _rangePoints[1].x = CGFloat(xIndex)
                _rangePoints[1].y = CGFloat(low) * phaseY

                _openPoints[0].x = CGFloat(xIndex) - 0.5 + barSpace
                _openPoints[0].y = CGFloat(open) * phaseY
                _openPoints[1].x = CGFloat(xIndex)
                _openPoints[1].y = CGFloat(open) * phaseY

                _closePoints[0].x = CGFloat(xIndex) + 0.5 - barSpace
                _closePoints[0].y = CGFloat(close) * phaseY
                _closePoints[1].x = CGFloat(xIndex)
                _closePoints[1].y = CGFloat(close) * phaseY
                
                trans.pointValuesToPixel(&_rangePoints)
                trans.pointValuesToPixel(&_openPoints)
