HPI marks a bar on the price chart when its open is the highest open over a configurable lookback and the bar is red, meaning the open is above the close.
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
38 lines of Pine Script v4 from indicator/single/high_price.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
high_price.pine
//@version=4
// -------------------------------------------------------------------------- //
study(title="HPI", shorttitle="HPI", overlay=true)
// -------------------------------------------------------------------------- //
hrb = input(title="HPI Recent Bar", type=input.integer, defval=50, minval=1, step=1)
// new_crb returns true if the current bar is red, that is, the current open
// price is higher than the current close price. This signals a local downward
// movement. Here crb means current red bar.
new_crb() =>
open > close
// new_hpi returns a high price indicator for the most recent bars since hrb.
// Here hpi means high price indicator.
new_hpi(hrb) =>
highest(open, hrb) == open and new_crb()
// -------------------------------------------------------------------------- //
plotshape(new_hpi(hrb), text="HPI", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
Overview
HPI plots a small red label reading HPI above that bar. The only setting, HPI Recent Bar, sets how many bars the highest-open check uses, with a default of 50. It does not define entries, exits, or risk rules. The marker can change while the current bar is still forming because it depends on the live close.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
HPI Recent Bar
int
50
hrb
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 overlays up to five higher-timeframe candlestick groups on the price chart. For each enabled timeframe it requests open, high, low, and close and can show up to five candles, offset by a spacing setting. The main inputs set the candle count, the
This indicator plots optional candlestick pattern signals on the price chart. It detects engulfing bars, inside bars, HOLP and LOHP, kicker patterns, body-mass extremes, higher highs and lower lows, ATR warnings, and four-bar fractals. Optional pivot marks use
The Strat Assistant indicator identifies candlestick patterns from the STRAT methodology on the price chart. It detects inside bars, 2-candle directional bars, 3-candle outside bars, and sequences like 212 and 222 for continuations and reversals. Shapes such a
This overlay indicator highlights candles with a body smaller than 50% of their total range by coloring them white on the price chart. Simultaneously, it calculates and plots horizontal lines for open prices across multiple higher timeframes, such as daily, we
This Pine Script indicator identifies liquidity sweeps and confirms signals using a close-back candle pattern directly on the price chart. It tracks recent swing highs and lows over a customizable lookback period. A bullish signal forms when a prior bar sweeps
This overlay indicator draws 80/20 price levels and optional 40-point zone bands on the price chart. It marks repairs, cross sections, and forks with optional letter labels, and can highlight confluence when those marks sit near a level. Separate options shade