OPEN-SOURCE SCRIPT

{Gunzo} Heiken Ashi Ribbons

Updated
Heiken Ashi Ribbons is a trend-following indicator which gives entry and exit points for short-term, medium-term and long term trading (using Exponential Moving Averages and Heiken Ashi formulas).

OVERVIEW :
The Heiken Ashi Ribbons indicator is composed of 3 moving average ribbons (slow, normal and fast) that are computed using the Heiken Ashi formulas. The 3 ribbons give a clear vision of the current trend as they use moving averages that smooth out the price and filter noise from short term fluctuations. In a simplified way, you can consider each ribbon as a moving average with a larger body size.
If the price is above the slow ribbon, we consider the asset as trending up in the short term (trending down otherwise). If the price is above the fast ribbon, we consider the asset as trending up in the long term (trending down otherwise).

CALCULATION :
First of all, to compute a ribbon for this indicator we calculate a moving average (EMA by default) for common sources (OHLC) :
EMA (open), EMA (high), EMA (low), EMA (close)

We then apply the Heiken Ashi formulas to the moving averages calculated previously.
HA (open) = HA (open) previous + HA (close) previous
HA (close) = ( EMA (open) + EMA (high) + EMA (low) + EMA (close) ) / 4
HA (high) = max( EMA (open), EMA (close), EMA (high) )
HA (low) = min ( EMA (open), EMA (close), EMA (low) )

The ribbon displayed (by default) on the chart is the area between HA (open) and HA (close).

SETTINGS :
  • 1st Moving average length : Length of the slow moving average
  • 2nd Moving average length : Length of the normal moving average
  • 3rd Moving average length : Length of the fast moving average
  • Moving average method : Moving average calculation method (EMA : Exponential Moving Average, SMA : Simple Moving Average, WMA : Weighted Moving Average)
  • Ribbon type : standard ribbon uses the area between HA (open) and HA (close). Large ribbon uses the area between HA (low) and HA (high)
  • Display ribbon as candles : change the type of visualization between area and candles
  • Display short term buy/sell signals : Display short term buy/sell signals (crosses) when the fast moving average and normal moving average are crossing
  • Display long term buy/sell signals : Display long buy/sell signals (circles) when the fast moving average and slow moving average are crossing
  • Display ribbon trending up signals : Display ribbon direction change (triangle up) when the trend of the ribbon changes to trending up
  • Display ribbon trending down signals : Display ribbon direction change (triangle down) when the trend of the ribbon changes to trending down


VISUALIZATIONS :
This indicator has 2 possible visualizations :
  • Ribbons : the ribbons can be considered as enhanced moving averages for trading purposes. They represent the area between the Heiken Ashi of the moving average of the open and closing price. The color of the moving average line is green when the ribbon is trending up and red when the ribbon is trending down.
  • Signals : Various signals can be displayed at the bottom of the chart (Buy/Sell signals, Ribbon direction changes signals).


USAGE :
This indicator can be used in many strategies, just like when you are using multiple moving averages. You should test these strategies and use the one that best fits your trading style.

Strategy based on crossovers :
  • When the fast ribbon crosses above the normal ribbon, it is a short term buy signal (it is recommended to wait for a confirmation)
  • When the fast ribbon crosses under the normal ribbon, it is a short term sell signal (it is recommended to wait for a confirmation)
  • When the fast ribbon crosses above the slow ribbon, it is a long term buy signal
  • When the fast ribbon crosses over the slow ribbon, it is a long term buy signal


Strategy based on price position :
  • When the prices closes above the ribbon, it is a buy signal (long term if above slow ribbon, short term if above fast ribbon)
  • When the prices closes below the ribbon, it is a sell signal (long term if below slow ribbon, short term if below fast ribbon)


Strategy based on price bouncing :
  • When the price decreases and reaches the green long term ribbon, the price candles may not be able to cross the ribbon. If the price increases, we consider that move as a bounce on the ribbon, which is a buy signal
  • When the price increases and reaches a red long term ribbon, the price candles may not be able to cross the ribbon. If the price decreases, we consider that move as a bounce on the ribbon, which is a sell signal


Strategy based on ribbon direction :
  • When the direction of the ribbon changes, the trend of the asset is changing which may lead to a crossover to the next candles if the trend is continuing in that direction (it is recommended to validate the entry points with a second indicator as this strategy may have some false signals).


Release Notes
updated screenshot
Release Notes
updated screenshot
Release Notes
Added alerts
crossoversExponential Moving Average (EMA)heiken-ashiMoving AveragesribbonsTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer