OPEN-SOURCE SCRIPT

Pivot Points HL Detailed

297
This indicator marks important turning points in the market, showing you the most recent swing high and swing low as horizontal lines across the chart. Each pivot line has a price label where it formed and a small counter that updates whenever the market touches that level again. The line’s color reflects the prevailing trend, determined by an EMA filter, so you can quickly see if the level is likely acting as support or resistance in the current market environment.

It works by scanning recent bars for points where price made a local high higher than several bars to its left and right, or a local low lower than several bars to its left and right. These pivots are calculated directly from price action using the ta.pivothigh and ta.pivotlow functions. Once identified, the level is tracked in real time, counting every time price crosses it. The EMA provides context: if price is above the EMA, the market is considered in an uptrend and the pivots are colored to match; if price is below, they’re marked as part of a downtrend.

For traders, this offers a clean way to see where the market has turned before and whether those levels are still relevant. Strong levels often show multiple touches, which can be used for entries, exits, or risk management. The built-in alert system can notify you when price approaches either the most recent swing high or swing low, so you can react quickly.

This tool can be applied in almost any market — forex, stocks, indices, commodities, or crypto — because price tends to respect recent swing points regardless of the asset class. It tends to be most effective in liquid markets, where many traders see and react to the same key levels, and it’s valuable in both trending and ranging conditions, though the EMA trend filter adds extra clarity when the market is moving directionally.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.