//-+------------------------------------------------------------------+-//
// | Name: Visual Heikin | //
// | Description: Draw background heiken ashi | //
// | Author: Tom's - Leofi | //
// | Last update: 02.03.20 | //
//-+------------------------------------------------------------------+-//
//-+------------------------------------------------------------------+-//
// | Variable Setup | //
//-+------------------------------------------------------------------+-//
//-> Custom color alpha for background
alphaColor = 75
//-> Draw backround
drawBackground = 1
//-+------------------------------------------------------------------+-//
// | Heikin Ashi | //
//-+------------------------------------------------------------------+-//
IF (BarIndex = 0) THEN
c = totalPrice
o = (open + close) / 2
ELSE
c = totalPrice
o = (o[1] + c[1]) / 2
ENDIF
//-+------------------------------------------------------------------+-//
// | Logic | //
//-+------------------------------------------------------------------+-//
IF (c > o) THEN
//-> Variable for alert signal
signalBullish = 1
signalBearish = 0
//-> Draw red background color if enabled
IF (drawBackground) THEN
backgroundColor(0, 200, 0, alphaColor)
ENDIF
ELSE
//-> Variable for alert signal
signalBullish = 0
signalBearish = 1
//-> Draw green background color if enabled
IF (drawBackground) THEN
backgroundColor(200, 0, 0, alphaColor)
ENDIF
ENDIF
//-> Return signal bullish and bearish
RETURN signalBearish coloured(233, 0, 0) style(histogram) AS "Signal BEARISH", signalBullish coloured(0, 233, 0) style(histogram) AS "Signal BULLISH", 1 AS "LvL Alert"