Indicator · Pine Script v4 · Own pane

Market Width

by iceberg211

This indicator plots the percentage of stocks in a selected index trading above their 20, 50, 100, 200, and selected other day moving averages.

View on GitHub

GitHub stars2on the repository
Pine versionv4older, still runs
Lines of code75
Settings10inputs
LicenceNone stated
Last update1 year ago26 Jul 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  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

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Market Width automatically detects the main chart symbol and switches to the corresponding index ticker such as S&P or NDX, or allows manual selection when auto switch is disabled. Each percentage is displayed as a separate line in a dedicated pane with distinct colors. Input controls enable or disable individual periods and adjust horizontal reference lines. The tool provides market breadth analysis for stocks and indices traders.

Details

Published by

iceberg211 on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Moving averages, Support & resistance

Markets

Stocks, Indices

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.

Settings

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

SettingTypeDefaultVariable
Auto switch with the main chart symbol [coverage: 'SPX'=S&P; 'NDX'=NQ100; 'IXIC'=NQ Comp; 'DJI'=Dow Indu; 'RUI'=Rus1000booltrueauto1
select Market manually when above 'Auto-switch' box is uncheckedstringS&Pmk2
% of stocks above 20 daybooltrueshow1
% of stocks above 50 daybooltrueshow2
% of stocks above 200 daybooltrueshow3
% of stocks above 5 dayboolfalseshow5
% of stocks above 100 daybooltrueshow4
% of stocks above 150 dayboolfalseshow6
horizontal reference line 1int80line_m
horizontal reference line 2int20line_m1
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

BTC Multiples

by readysetcryptocodes
43 stars

BTC Multiples calculates and displays Bitcoin macro valuation metrics in a separate pane, including the Mayer Multiple, Stock-to-Flow Multiple, Difficulty Multiple, and Puell Multiple. Each valuation multiple features configurable overvalued and undervalued th

Indicator v4 Moving averagesSupport & resistance
Updated 2 years ago · None stated GitHub repository of BTC Multiples

MACD Breakout

by jerryinyang
5 stars

MACD Breakout builds a higher-timeframe MACD from preset fast and slow lengths using SMA or EMA, and marks support and resistance zones from histogram sensitivity. Optional filters require zero-line agreement, higher-timeframe direction, and linear-regression

Indicator v4 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of MACD Breakout

Noob's Indicators

by InNoobWeTrust
4 stars

This Pine Script indicator plots multiple exponential moving averages in a separate pane for technical analysis. It calculates Elliott wave EMAs using Fibonacci wave counts of 34 and 89, plus 200-session and golden ratio lines. Additional Pythagorean cloud lev

Indicator v5 Moving averagesSupport & resistance
Updated today · None stated GitHub repository of Noob's Indicators

Cipher B

by diehardyearone
3 stars

Cipher B is a multi-indicator plotting WaveTrend oscillator lines and signals alongside Stochastic RSI, MFI area with color bars, and buy sell marks. It draws all elements in a separate pane. WaveTrend calculates using SMMA and EMA on source like ohlc4 with ad

Indicator v6 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of Cipher B
3 stars

This indicator demonstrates debugging visualization patterns for Pine Script. It plots value tracking with mean, min, and max reference lines, condition markers using shapes and arrows, historical comparisons with standard deviation bands, multi-series overlay

Indicator v5 Moving averagesVolatility & bands
Updated 7 months ago · None stated GitHub repository of Debugging Visualization Patterns

This indicator renders Ichimoku cloud components consisting of conversion line, base line, leading span A and leading span B. It tracks Tenkan-Kijun crosses and assigns a numeric score to each based on whether the cross occurs below, inside or above the Kumo c

Indicator v5 Moving averagesSupport & resistance
Updated 5 months ago · None stated GitHub repository of Ichimoku Cloud Weight Original

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers