                 var shadowColor: UIColor! = nil
                 if (dataSet.shadowColorSameAsCandle)
                 {
-                    if (e.open > e.close)
+                    if (open > close)
                     {
                         shadowColor = dataSet.decreasingColor ?? dataSet.colorAt(j)
                     }
-                    else if (e.open < e.close)
+                    else if (open < close)
                     {
                         shadowColor = dataSet.increasingColor ?? dataSet.colorAt(j)
                     }

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

                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(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(high) * phaseY
                    _shadowPoints[1].y = CGFloat(open) * phaseY
                    _shadowPoints[2].y = CGFloat(low) * phaseY
                    _shadowPoints[3].y = _shadowPoints[1].y
                }
                
