This is my first indicator with prorealcode for learning the language.
It is a smoothed Heikin-Ashi with possibility to hide Heikin-Ashi and only color the “normal” candles.
// ############# Heikin-Ashi Advanced ##################################################
// Written by GSL
bo = Average[MAX(1,sma1),AverrageType1](Open)
bh = Average[MAX(1,sma1),AverrageType1](high)
bl = Average[MAX(1,sma1),AverrageType1](low)
bc = Average[MAX(1,sma1),AverrageType1](close)
IF BarIndex <= sma1 + 1 THEN
haOpen = bo
haClose = bc
haHigh = bh
haLow = bl
//PRINT(haClose)
ELSe
haOpen = (haOpen[1] + haClose[1]) / 2
haClose = (bo + bc + bl + bh ) / 4
haHigh = MAX( MAX(bh , haOpen), haClose )
haLow = MIN( MIN(bl , haOpen), haClose )
ao = Average[MAX(1,sma2),AverrageType2](haOpen)
ah = Average[MAX(1,sma2),AverrageType2](haHigh)
al = Average[MAX(1,sma2),AverrageType2](haLow)
ac = Average[MAX(1,sma2),AverrageType2](haClose )
ENDIF
if hidden THEN
IF ao < ac THEN
DRAWCANDLE(open, high, low, close) COLOURED(0,55,30)
ELSIF ao > ac THEN
DRAWCANDLE(open, high, low, close) COLOURED(55,15,0)
ELSE
DRAWCANDLE(open, high, low, close)
ENDIF
ELSE
IF ao < ac THEN
DRAWCANDLE(ao, ah, al, ac)
ELSIF ao > ac THEN
DRAWCANDLE(ao, ah, al, ac)
ELSE
DRAWCANDLE(ao, ah, al, ac)
ENDIF
ENDIF
RETURN