OPEN-SOURCE SCRIPT

Session Gap Fill [LuxAlgo]

5 227
The Session Gap Fill tool detects and highlights filled and unfilled price gaps between regular sessions. It features a dashboard with key statistics about the detected gaps.

The tool is highly customizable, allowing users to filter by different types of gaps and customize how they are displayed on the chart.

🔶 USAGE

快照

By default, the tool detects all price gaps between sessions. A price gap is defined as a difference between the opening price of one session and the closing price of the previous session. In this case, the tool uses the opening price of the first bar of the session against the closing price of the previous bar.

A bullish gap is detected when the session open price is higher than the last close, and a bearish gap is detected when the session open price is lower than the last close.

快照

Gaps represent a change in market sentiment, a difference in what market participants think between the close of one trading session and the open of the next.

What is useful to traders is not the gap itself, but how the market reacts to it.
  • Unfilled gaps occur when prices do not return to the previous session's closing price.
  • Filled gaps occur when prices come back to the previous session's close price.


By analyzing how markets react to gaps, traders can understand market sentiment, whether different prices are accepted or rejected, and take advantage of this information to position themselves in favor of bullish or bearish market sentiment.

Next, we will cover the Gap Type Filter and Statistics Dashboard.

🔹 Gap Type Filter

快照

Traders can choose from three options: display all gaps, display only overlapping gaps, or display only non-overlapping gaps. All gaps are displayed by default.

An overlapping gap is defined when the first bar of the session has any price in common with the previous bar. No overlapping gap is defined when the two bars do not share any price levels.

As we will see in the next section, there are clear differences in market behavior around these types of gaps.

🔹 Statistics Dashboard

快照

The Statistics Dashboard displays key metrics that help traders understand market behavior around each type of gap.
  • Gaps: The percentage of bullish and bearish gaps.
  • Filled: The percentage of filled bullish and bearish gaps.
  • Reversed: The percentage of filled gaps that move in favor of the gap
  • Bars Avg.: The average number of bars for a gap to be filled.


Now, let's analyze the chart on the left of the image to understand those stats. These are the stats for all gaps, both overlapping and non-overlapping.

Of the total, bullish gaps represent 55%, and bearish ones represent 44%. The gap bias is pretty balanced in this market.

The second statistic, Filled, shows that 63% of gaps are filled, both bullish and bearish. Therefore, there is a higher probability that a gap will be filled than not.

The third statistic is reversed. This is the percentage of filled gaps where prices move in favor of the gap. This applies to filled bullish gaps when the close of the session is above the open, and to filled bearish gaps when the close of the session is below the open. In other words, first there is a gap, then it fills, and finally it reverses. As we can see in the chart, this only happens 35% of the time for bullish gaps and 29% of the time for bearish gaps.

The last statistic is Bars Avg., which is the average number of bars for a gap to be filled. On average, it takes between one and two bars for both bullish and bearish gaps. On average, gaps fill quickly.

As we can see on the chart, selecting different types of gaps yields different statistics and market behavior. For example, overlapping gaps have a greater than 90% chance of being filled, whereas non-overlapping gaps have a less than 40% chance.

🔶 SETTINGS

  • Gap Type: Select the type of gap to display.


🔹 Dashboard

  • Dashboard: Enable or disable the dashboard.
  • Position: Select the location of the dashboard.
  • Size: Select the dashboard size.


🔹 Style

  • Filled Bullish Gap: Enable or disable this gap and choose the color.
  • Filled Bearish Gap: Enable or disable this gap and choose the color.
  • Unfilled Gap: Enable or disable this gap and choose the color.
  • Max Deviation Level: Enable or disable this level and choose the color.
  • Open Price Level: Enable or disable this level and choose the color.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。