Heikin Ashi Advanced

Category: Indicators By: gidien Created: January 15, 2024, 1:47 PM
January 15, 2024, 1:47 PM
Indicators
4 Comments

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

Download
Filename: Heikin-Ashi-Advanced.itf
Downloads: 344
Download
Filename: haadvhide-17049895554pc8l.png
Downloads: 101
gidien New
Code artist, my biography is a blank page waiting to be scripted. Imagine a bio so awesome it hasn't been coded yet.
Author’s Profile

Comments

Logo Logo
Loading...