Visual Heikin
“Candle heikin-ashi green = Background green = Signal Bullish”
“Candle heikin-ashi red = Background red = Signal Bearish”
- The indicator returns a signal for the bullish signal and for the bearish signal, so you can easily create an alert to warn you. LvL Alert is always at 1, the signal bearish or bullish is at 0 and will become 1 if there is a signal.
- Disable and enable background color
- Custom background color alpha
- Show on price or below price
Enjoy 💙
//-+------------------------------------------------------------------+-//
// | 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"
Thanks for sharing @leofi