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
175 lines of Pine Script v5 from Tradingview/heikin-ashi-pivot-trendlines.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Heikin Ashi with Pivot Trendlines combines a fast and slow moving average cloud with a long-term trend filter moving average. Trade signals are triggered by moving average crossovers and optional three-bar confirmation filters, using pivot points for stop-loss placement and a configurable risk-to-reward target multiplier. Key settings include moving average types and lengths, pivot detection periods, and trade direction toggles.
Dual moving average trend cloud with selectable MA types
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
MA 1
int
9
ma1_length
ma1_type
string
EMA
ma1_type
MA 2
int
20
ma2_length
ma2_type
string
EMA
ma2_type
Filter MA
int
200
long_ma_length
long_type
string
EMA
long_type
Bull Color
color
color.green
bull_color
Bear Color
color
color.red
bear_color
MA 1 Color
color
color.gray
ma1_color
MA 2 Color
color
color.gray
ma2_color
Pivot Length
int
3
pivot_length
Debug
bool
false
pivot_debug
Show all 20 settings
Setting
Type
Default
Variable
Long Trades
bool
true
long_trades
Short Trades
bool
true
short_trades
Use 3 Bar
bool
true
use_3_bar
Use Filter
bool
true
use_filter
Tgt Amount
float
1.50
target_mult
Entry Color
color
color.blue
entry_color
Tgt Color
color
color.green
tgt_color
Stop Color
color
color.red
stop_color
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.
This indicator analyzes short-term price action on index futures and options charts by applying Rational Quadratic kernel smoothing to detect sideways consolidation ranges and potential breakouts. It processes pivot highs and lows over customizable loopback pe
This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts
This indicator overlays trend-following Supertrend bands on the price chart using Average True Range calculations. It plots trailing stop lines, highlights active trend directions, and prints buy or sell shape labels when price closes across band thresholds. I
This indicator plots two Hull moving averages on the price chart, one of the selected price and one of close, and optionally smooths both with a Kahlman filter. It fills the space between them and marks buy and sell labels when they cross, provided scaled volu
The MA Envelope indicator calculates upper and lower channel bands shifted by a user-defined percentage around a baseline moving average. It supports Simple Moving Average, Exponential Moving Average, and Weighted Moving Average calculation types. The script p
This indicator calculates an Exponential Moving Average and a Zero-Lag Moving Average to identify market trends on the price chart. It plots both moving averages and fills the space between them with color to highlight trend direction. Upon a crossover or cros