//int candleWidth private void DrawCandle(Operacao oper, TradeSystem tradeSystem, Candle candle, bool atual) { float cw = candleWidth() * 0.8f; float x = GetWidthForPeriodo(contaPers) - cw / 2; float dif = Math.Abs(candle.GetValor(FormulaManager.OPEN) - candle.GetValor(FormulaManager.CLOSE)); float y = GetYPosition(candle.GetValor(FormulaManager.OPEN)); float w = cw; float h = GetHeightValueAbs(dif); Color cor = atual ? Color.Green : Color.White; if (candle.GetValor(FormulaManager.OPEN) < candle.GetValor(FormulaManager.CLOSE)) { cor = atual ? Color.Red : Color.Black; y -= h; } //stop float vlrStop = oper.stop.CalcStop(candle); DrawLine(x, GetYPosition(vlrStop), x + cw, GetYPosition(vlrStop), Color.Red); //target float vlrTarget = oper.CalcAlvo(candle); DrawLine(x, GetYPosition(vlrTarget), x + cw, GetYPosition(vlrTarget), Color.Green); RectangleShape corpo = new RectangleShape((int)x, (int)y, (int)w, (int)h); corpo.FillColor = cor; corpo.FillStyle = FillStyle.Solid; corpo.BorderColor = Color.Black; shapes.Add(corpo); corpo.Parent = canvas; DrawLine(x + cw / 2, GetYPosition(candle.GetValor(FormulaManager.LOW)), x + cw / 2, GetYPosition(candle.GetValor(FormulaManager.HIGH)), Color.Black); //DrawLine(x-cw/2, GetYPosition(candle.GetValor(FormulaManager.LOW)), x + cw/2, GetYPosition(candle.GetValor(FormulaManager.LOW)), Color.Blue); //DrawLine(x - cw / 2, GetYPosition(candle.GetValor(FormulaManager.HIGH)), x + cw / 2, GetYPosition(candle.GetValor(FormulaManager.HIGH)), Color.Blue); }