Indicator · Pine Script v6 · On the chart

Market Shift Levels [ChartPrime]

by theonetrade· code credited to ChartPrime

Market Shift Levels [ChartPrime] identifies dynamic support and resistance levels using crossover signals from a Hull Moving Average.

View on GitHub

GitHub stars34on the repository
Pine versionv6current
Lines of code55
Settings4inputs
LicenceMIT
Last update2 weeks ago8 Nov 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

55 lines of Pine Script v6 from assets/indicator/bit-exact/market_shift_levels_chartprime_urTBALXa.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

market_shift_levels_chartprime_urTBALXa.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ChartPrime

//@version=6
indicator("Market Shift Levels [ChartPrime]", max_labels_count = 500, overlay = true)

// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
int    length        = input.int(55, "Length")
bool   lbl_data      = input.string("Volume", "Label Data: ", ["Volume", "Price"]) == "Volume"
color  color_shiftUp = input.color(color.rgb(36, 213, 128), "", inline = "col")
color  color_shiftDn = input.color(color.rgb(225, 43, 43), "", inline = "col")

// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
var level       = float(na)
float hma1      = ta.hma(close,length)
float hma2      = hma1[5]
float vol_sum   = (volume[2] + volume[1] + volume[0])

if ta.crossover(hma1, hma2)
    level := low
if ta.crossunder(hma1, hma2)
    level := high

color shift_col = close < level ? color_shiftDn : color_shiftUp


// --------------------------------------------------------------------------------------------------------------------}
// 📌 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{

plot(level != level[1] ? na : level, "Market Shift Levels", color = bar_index % 2 == 0 ? color(na) : chart.fg_color, style = plot.style_linebr)

// Possible Reversals
if high[2] < level and high < level and high[1] > level
    label.new(bar_index-1, high[1]
             , str.tostring(lbl_data ? vol_sum : high[1], lbl_data ? format.volume : "#,####.###") + "\n⬙"
             , color = color(na)
             , textcolor = color.red
             , style = label.style_label_down)

if low[2] > level and low[1] < level and low > level 
    label.new(bar_index-1, low[1]
             ,  "⬘\n" + str.tostring(lbl_data ? vol_sum : high[1], lbl_data ? format.volume : "#,####.###")
             , color = color(na)
             , textcolor = color.lime
             , style = label.style_label_up)

// Candles Color
barcolor(shift_col, title = "Bar Color")
plotcandle(open, high, low, close, title='Candles Color', color = shift_col, wickcolor=shift_col, bordercolor = shift_col, force_overlay = true)
// --------------------------------------------------------------------------------------------------------------------}

Overview

When the main HMA crosses its 5-bar delayed value, the indicator updates the shift level to the swing low or high. It draws dashed level lines directly on the price chart and colors bars based on whether price is trading above or below the active level. It also detects potential market reversals around these shift levels, annotating them with customizable price or volume labels.

Details

Published by

theonetrade on GitHub

Code credit

ChartPrime, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Lengthint55length
Label Data: stringVolumelbl_data
color_shiftUpcolorcolor.rgb(36, 213, 128)color_shiftUp
color_shiftDncolorcolor.rgb(225, 43, 43)color_shiftDn
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.

Similar Pine Scripts

257 stars

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

Indicator v5 Support & resistanceTrend Repaints
Updated 2 months ago · None stated GitHub repository of SPX 30M - Trading Chart

Ichimoku Cloud

by harryguiacorn
220 stars

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

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ichimoku Cloud

MA Envelope (MAE)

by mihakralj
99 stars

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

Indicator v6 Moving averagesSupport & resistance
Updated 8 weeks ago · Apache-2.0 GitHub repository of MA Envelope (MAE)
56 stars

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

Indicator v5 TrendMoving averages
Updated 3 months ago · None stated GitHub repository of No-Lag MA Trend Levels

More Support & resistance scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers