1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
19 lines of Pine Script v6 from lib/core/ha/ha.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.
ha.pine
// HA: Heikin-Ashi
// Smoothed candle transformation with recursive open
// HA_Close = (O + H + L + C) / 4
// HA_Open = (prev_HA_Open + prev_HA_Close) / 2
// HA_High = max(H, HA_Open, HA_Close)
// HA_Low = min(L, HA_Open, HA_Close)
//@version=6
indicator("HA: Heikin-Ashi", overlay=true)
var float haOpen = na
var float haClose = na
haClose := (open + high + low + close) * 0.25
haOpen := na(haOpen) ? (open + close) * 0.5 : (haOpen + haClose[1]) * 0.5
haHigh = math.max(high, haOpen, haClose)
haLow = math.min(low, haOpen, haClose)
plotcandle(haOpen, haHigh, haLow, haClose, "HA", color=haClose >= haOpen ? color.green : color.red)
Overview
HA: Heikin-Ashi derives the smoothed close from standard price averages and recursively computes the open, high, and low values. The script does not issue trade signals or alerts, coloring candles green when the close equals or exceeds the open and red otherwise. It contains no configurable input settings. A notable limitation is that it provides only visual candle transformations without automated trade rules or customizable smoothing parameters.
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an
This indicator detects a large set of classic candlestick patterns and plots colored labels on the price chart. Trend context uses a 50-period simple moving average, or the 50 and 200 averages stacked together, and can be switched off. Users filter bullish, be
Five-in-one Strategy combines five analytical tools into a single price chart overlay: the Dual Thrust Trading Algorithm (DTTA), Semafore, HalfTrend, Nick Rypock Trailing Reverse, and Tweezer or Kangaroo Tail candlestick patterns. It generates trade signals us
This indicator overlays on the price chart and provides trend and momentum analysis. It calculates and plots three exponential moving averages with fixed periods of 20, 50, and 200 using yellow, orange, and blue colors respectively. The script also computes th
The Confluence Suite indicator draws multiple trading signals and tools directly on the price chart. It generates entry and exit signals based on selected modes and filters, with an AI signal classifier rating quality from 1-4. Additional features include smar
This indicator identifies the Bullish Abandoned Baby candlestick pattern directly on the price chart. The three-bar reversal pattern consists of a strong down candle during an established downtrend, followed by a lower gapping doji candle, and completed by an