Indicator · Pine Script v5 · Own pane

Gaps

by fiji-solutions· code credited to cmoutafidis

The Gaps indicator measures and plots the percentage price gap between consecutive bars in a separate pane.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code10
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago3 Oct 2024

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

10 lines of Pine Script v5 from 05. Candlestick Patterns/07. Calculating Gaps.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

07. Calculating Gaps.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cmoutafidis

//@version=5
indicator(title="Gaps", precision = 5)

gapClose = math.abs((open - close[1]) / open)
gapDistance = low > high[1] ? ((low - high[1]) / low) * 100 : ((high - low[1]) / high) * 100

plot(gapDistance)

Overview

Gaps evaluates whether the current bar low is above the previous bar high or the current bar high is below the previous bar low, calculating the relative gap distance as a percentage. The plotted values provide a simple quantitative visualization of price jump magnitudes without requiring any input settings or configuration. It displays directly in a lower pane below the main price chart.

Details

Published by

fiji-solutions on GitHub

Code credit

cmoutafidis, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Candlestick patterns, 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.

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

Candle Pressure & Response (JMA) evaluates price action dynamics by calculating bidirectional candle pressure, upper and lower wick rejection fractions, body efficiency, and range expansion metrics relative to ATR. Each output series is smoothed using a Jurik

Indicator v6 Candlestick patternsVolatility & bands
Updated yesterday · MIT GitHub repository of Candle Pressure & Response (JMA)

GainzAlgo V2 [Alpha]

by krishnandank
4 stars

This indicator generates buy and sell signals based on engulfing candlestick patterns, a candle stability ratio relative to true range, RSI thresholds, and a multi-bar price momentum condition. It draws visual signal labels on the chart alongside suggested tak

Indicator v5 Candlestick patternsOscillators & momentum
Updated 1 year ago · None stated GitHub repository of GainzAlgo V2 [Alpha]
2 stars

This educational indicator calculates and visualizes market gap sizes in a separate pane. It computes two distinct metrics: the absolute percentage gap between the current bar open and the previous close, and the percentage gap distance between the current bar

Indicator v5 Candlestick patternsVolatility & bands
Updated 2 years ago · None stated GitHub repository of Candlesticks - Calculating Gaps

Altcoin Analyzer [Lysergik]

by LysergikProductions
1 stars

This indicator plots the relative price of an altcoin against Bitcoin by dividing the current symbol's OHLC values by INDEX:BTCUSD data. It displays the synthetic pair as either a simple line or custom candlesticks with an optional Heikin-Ashi calculation in a

Indicator v5 Volatility & bandsCandlestick patterns Repaints
Updated 4 years ago · AGPL-3.0 GitHub repository of Altcoin Analyzer [Lysergik]

Engulf Indicator

by theomgdev
1 stars

The Engulf Indicator calculates a custom candlestick metric in a separate pane by evaluating the ratio of candle body size to total candle range, comparing it with the previous bar's body size, and normalizing the result with the Average True Range (ATR). It p

Indicator v5 Candlestick patternsVolatility & bands
Updated 2 years ago · None stated GitHub repository of Engulf Indicator

Body Mass Indicator

by harryguiacorn
219 stars

The Body Mass Indicator highlights candles with exceptionally large body ranges relative to recent price movement. It calculates the absolute distance between open and close prices. When enabled, it identifies bars where the body range achieves a new high over

Indicator v5 Volatility & bandsCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Body Mass Indicator

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