Indicator · Pine Script v4 · Own pane

Test-033-Distribution

by ricardosantos79· code credited to RicardoSantos

This indicator measures the absolute bar-to-bar change of the close and tracks the smallest and largest of those changes seen so far.

View on GitHub

GitHub stars261on the repository
Pine versionv4older, still runs
Lines of code33
Settings1inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago13 Nov 2021

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

33 lines of Pine Script v4 from beta/arrays/test-033-distribution.pinescript, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

test-033-distribution.pinescript
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos

//@version=4
study(title="test-033-distribution", max_bars_back=501)


var float max_range = 0.0
var float min_range = 0.0

float range = abs(change(close))//atr(14)
float avg_range = cum(range) / (bar_index + 1)

if bar_index > 14
    max_range := max(range, max_range)
    min_range := min(range, min_range)
else
    max_range := range
    min_range := range

int rate = int((range - min_range) / (max_range - min_range) * 100)

int length = input(500)
var int[] distribution = array.new_int(size=101, initial_value=0)
if barstate.islast and bar_index > length
    for _i = 0 to length
        array.set(id=distribution, index=rate[_i], value=array.get(id=distribution, index=rate[_i]) + 1)
        
t = tostring(distribution)

var label la = label.new(bar_index, 0.0, '')
label.set_xy(id=la, x=bar_index, y=0.0)
label.set_text(id=la, text=t)

Overview

Test-033-Distribution maps each change onto a 0 to 100 scale between that minimum and maximum, then, on the last bar only, counts how often each integer rate occurred over the most recent bars. The single input sets how many bars enter the count. It draws the resulting 101-bin tally as text in a label in a separate pane and does not plot price signals or trade rules.

Details

Published by

ricardosantos79 on GitHub

Code credit

RicardoSantos, as written in the script's header

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Volatility & bands

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.

Settings

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

SettingTypeDefaultVariable
lengthint500length
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

This indicator calculates the distribution of close-to-close percentage changes using rate of change on closing prices. It bins percentage changes into intervals of 0.25 percent increments from negative to positive values and plots a normalized cumulative hist

Indicator v4 Volatility & bands
Updated 10 days ago · GPL-3.0 GitHub repository of Close-to-Close % Change Distribution

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
330 stars

This indicator plots candle range and open-to-close movement as percentages in a separate pane. Range is the high-low difference divided by the low, and change is the close-open difference divided by the open. Both series draw as columns. Teal columns show ran

Indicator v5 Volatility & bands
Updated 2 months ago · None stated GitHub repository of Percent & Volatility [Alorse]

Mojito v3 Strategy

by namuan
318 stars

The Mojito v3 Strategy indicator evaluates volatility term structure by calculating the ratio between front-month and second-month VIX futures contracts. It smooths this ratio using a configurable median filter and compares the result against user-defined uppe

Indicator v5 Volatility & bands
Updated 2 months ago · MIT GitHub repository of Mojito v3 Strategy

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector

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