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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
// ############# 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 |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Caro Gidien
How can I set up a trading system to test this indicator?
This indicator will not return any value.
You can change the last line to :
return ao AS “HA Open”, ac AS “HA Close, al AS “HA Low” , ah AS “HA High”
After that you can call this indicator in your code and use his values.
Bonjour, qu’elles sont les valeurs des variables ?
Avec mes remerciements Marc
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