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
You must be logged in to post a comment.
SMA1 = MovingAverage Length applied to the source candles (high , low, open, close) AverrageType1 = Type of the first Average (simple , expo .....) SMA2 = MovingAverage Length applied to the heikin ashi candles (hahigh , halow, haopen, haclose) AverrageType2 = Type of the second Average (simple , expo .....) hidden = If enabled you will only see the original candle , but with the color of the underlying heikin ashi candle. If disable you will see the original candle and the heikin ashi candle. SMA1 = 1 AND SMA2 = 1 is same the same as the normal Heikin Ashi Candles
Bonjour, qu'elles sont les valeurs des variables ? Avec mes remerciements Marc