OPEN-SOURCE SCRIPT
Session Gap Fill [LuxAlgo]

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.
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.
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
🔹 Dashboard
🔹 Style
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 אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
Get access to our exclusive tools: luxalgo.com
Join our 150k+ community: discord.gg/lux
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Join our 150k+ community: discord.gg/lux
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
Get access to our exclusive tools: luxalgo.com
Join our 150k+ community: discord.gg/lux
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Join our 150k+ community: discord.gg/lux
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.