LazyBear

Vervoort Heiken Ashi Candlestick Oscillator

Heiken-Ashi Candlestick Oscillator (HACO), by Sylvian Vervoort, is a digital oscillator version of the colored candlesticks.

Explanation from Vervoort:

"HACO is not meant to be an automatic trading system, so when there is a buy or sell signal from HACO, make sure it is confirmed by other TA techniques. HACO will certainly aid in signaling buy/sell opportunities and help you hold on to a trade, making it more profitable. The behavior of HACO is closely related to the level and speed of price change. It can be used on charts of any time frame ranging from intraday to monthly."

HACO has 2 configurable length parameters - "UP TEMA length" and "Down TEMA length". Vervoort suggests having them the same value.

I have also added an option to color the bars (overlay mode).

More info:
Trading with the Heiken-Ashi Candlestick Oscillator - Sylvian Vervoort

List of my other indicators:
- GDoc: https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
- Chart:
Master Index: List of all my indicators


Remove from Favorite Scripts Add to Favorite Scripts
//
// @author LazyBear 
// List of all my indicators: 
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
//
study("Vervoort Heiken Ashi Candlestick Oscillator [LazyBear]", shorttitle="HACO_LB")
avgup = input(title="Up TEMA Length", defval=34, minval=1, maxval=100 ) 
avgdn = input(title="Down TEMA Length", defval=34, minval=1, maxval=100 ) 
overlayMode=input(defval=false, title="Overlay mode (color bars)?")

calc_tema(src, length) =>
	ema1 = ema(src, length)
	ema2 = ema(ema1, length)
	ema3 = ema(ema2, length)
	3 * (ema1 - ema2) + ema3

calc_zltema( src, length ) => 
	tma1 = calc_tema( src, length ) 
	tma2 = calc_tema( tma1, length ) 
	diff = tma1 - tma2 
	tma1 + diff  
 
haO = (ohlc4[1] + nz(haO[1]))/2
haC = (ohlc4+haO+max(high,haO)+min(low,haO))/4

upTMA1= calc_zltema(haC,avgup)
upTMA2= calc_zltema(upTMA1,avgup)
upDiff= upTMA1 - upTMA2
upZlHa= upTMA1 + upDiff
upTMA12= calc_zltema(hl2,avgup)
upTMA22= calc_zltema(upTMA12,avgup)
upDiff2= upTMA12 - upTMA22
upZlCl= upTMA12 + upDiff2
upZlDiff= upZlCl - upZlHa
upKeep1= (haC >= haO) and (haC[1] >= haO[1])
upKeep2= upZlDiff>=0
upKeeping= (upKeep1 or upKeep2)
upKeepAll= upKeeping or (nz(upKeeping[1]) and (close>=open) or close>=close[1])
upKeep3= (abs(close-open)<(high-low)*0.35 and high>=(low[1]))
upTrend= upKeepAll or (nz(upKeepAll[1]) and upKeep3)

dnTMA1= calc_zltema(haC,avgdn)
dnTMA2= calc_zltema(dnTMA1,avgdn)
dnDiff= dnTMA1 - dnTMA2
dnZlHa= dnTMA1 + dnDiff
dnTMA12= calc_zltema(hl2,avgdn)
dnTMA22= calc_zltema(dnTMA12,avgdn)
dnDiff2= dnTMA12 - dnTMA22
dnZlCl= dnTMA12 + dnDiff2
dnZlDiff= dnZlCl - dnZlHa
dnKeep1= haC<haO and (haC[1]<haO[1]) 
dnKeep2= dnZlDiff<0
dnKeep3= abs(close-open)<(high-low)*0.35 and low<=high[1]
dnKeeping= dnKeep1 or dnKeep2
dnKeepAll= dnKeeping or (nz(dnKeeping[1]) and (close<open) or (close<close[1]))
dnTrend= iff(dnKeepAll or (nz(dnKeepAll[1]) and dnKeep3)==1,1,0)

upw= dnTrend==0 and nz(dnTrend[1]) and upTrend
dnw= upTrend==0 and nz(upTrend[1]) and dnTrend
haco= iff(upw,1,iff(dnw,-1,nz(haco[1])))
haco_c=haco>0?green:red

plot(not overlayMode ? haco : na, style=columns, color=haco_c)
barcolor(overlayMode ? haco_c : na)
List of my free indicators: http://bit.ly/1LQaPK8
List of my indicators at Appstore: http://blog.tradingview.com/?p=970

kakola
2 years ago
Why is a TEMA being used to calculate HA bars, I don't get it
Reply
LazyBear PRO kakola
2 years ago
Vervoort always uses a modified HACO calculation. Check out my other Vervoort scripts.
+1 Reply
Love your work LazyBear...always top shelf!
+1 Reply
LazyBear PRO coondawg71
2 years ago
Thanks.
+1 Reply
ChartArt
2 years ago
Thanks for sharing this interesting indicator, it works quite good in my first test.

Only one tiny not important issue: I'm usually extremely happy with every of your coding decisions, but in this case I don't like the automatic hiding of the oscillator as soon as the color the bars (the overlay mode) is activated. I would prefer to see both the oscillator and the colored bars at the same time and only have an extra option (if possible) to hide the oscillator when the overlay mode is activated.
Reply
LazyBear PRO ChartArt
2 years ago
YW.

idea behind overlay is to save one indicator pane. If you want to show the oscillator and colored bars, you can add another instance of this indicator and set one to overlaid, the other to osc-mode (just like my published chart above).

If you still want to do both simultaneously using ONE indicator instance, change this line in the source

>> plot(not overlayMode ? haco : na, style=columns, color=haco_c)

to

>> plot(haco, style=columns, color=haco_c)

+2 Reply
ChartArt LazyBear
2 years ago
Simply adding it twice was my work-around idea :) but changing the code is even better. Thank you for the help.
+1 Reply
BizkitBR PRO
2 years ago
https://www.tradingview.com/e/FBTAKf8e/#

Hey love your work.... Is there a way to come combine your Vervoort Heiken Ashi Candle Oscillator and Pekipeks PPO Divergence indicator? Check it out it seems to work great...
Reply
LazyBear PRO BizkitBR
2 years ago
What do u mean by "combine"? you can merge them in to the same pane now (right click and "merge up/down"), if thats what you are looking for.
+1 Reply
jamestrade14
2 years ago
Great indicator is there anyway that you can make alerts on these indicators?
Reply
LazyBear PRO jamestrade14
2 years ago
Yes, alerts can be done on this. @ChrisMoody has a video on how to setup alerts.
+1 Reply
People are searching out chart overlays with candle indicators that work better than traditional candles.

Thanks for your constant research and trials.
Reply
LazyBear PRO QuantitativeExhaustion
2 years ago
yw
Reply
lebbins PRO
3 months ago
Hi, can I ask whether this indicator has to be used on HA charts or can it be used on normal candlesticks charts. I noticed the values of the indicators are indicator when I switch chart type. Wondering what is the correct chart type to use and what would be the adjustment to the source code if I need to use it in candlesticks charts (or renko charts) instead of HA charts?
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out