OPEN-SOURCE SCRIPT
已更新 Gap Closure Stats

# Gap Closure Stats — Publication Description
---
## What This Indicator Does
**Gap Closure Stats** tracks the gap between each session's **4:15pm ET close** (the anchor price) and up to three configurable **opening prices** — by default the midnight open (00:00 ET), the London/European open (03:00 ET), and the RTH open (09:30 ET). For each of those levels it draws a coloured box on the chart spanning from the anchor price to the opening price, and records statistics on how often price subsequently fills that gap during the regular trading session.
Every percentage in the stats table is computed **live, from the history on your own chart**. There are no hard-coded numbers. The statistics describe exactly the instrument and timeframe you are looking at, and they update automatically as new sessions complete.
The indicator answers a core structural question about daily price behaviour:
- Given a gap of a certain size between yesterday's 4:15pm close and today's open, how often does price retrace back to that 4:15pm level (a full gap fill)?
- How often does price retrace at least a defined partial amount of the gap?
- Do these tendencies differ depending on whether the gap is up or down?
- Do they change when the gap is unusually large or small relative to recent history?
It is an analytical and contextual tool. It does not issue buy or sell signals.
---
## Core Concepts and Definitions
### The Anchor Price (4:15pm ET Close)
The reference price for each trading day is the **close of the 4:15pm ET bar** from the prior session. This is captured during a narrow one-minute anchor session (default 16:15–16:16 ET). The anchor represents where the market last traded before overnight activity begins, and it is the level that a "gap fill" requires price to return to.
### The Gap
A gap exists when the opening price at one of the three configurable levels differs from the anchor. If the opening price is **above** the anchor, the gap is **up** — price has gapped higher overnight and a fill means price would need to fall back to the anchor. If the opening price is **below** the anchor, the gap is **down** — price would need to rally back to fill it.
The **gap size** in points is the absolute difference between the anchor and the opening price.
### Gap Size Buckets (Quartiles vs. History)
Each day's gap size is classified into one of four buckets based on where it falls in the **historical distribution of all prior gaps** on your chart:
- **Q1 (0–25th percentile)** — the smallest gaps relative to history
- **Q2 (25–50th percentile)** — below-median gaps
- **Q3 (50–75th percentile)** — above-median gaps
- **Q4 (75–100th percentile)** — the largest gaps relative to history
This classification requires at least 4 prior sessions of data before it becomes meaningful. On very fresh charts, all gaps are assigned to Q2 until enough history accumulates. The bucket thresholds update as each new session completes.
### Full Gap Fill (Hit%)
A **full gap fill** (labelled **FULL%** in the table) is recorded when price trades at or through the anchor price at any point during the RTH session (09:30–16:00 ET). It does not matter whether price opens, then reverses immediately, or whether it fills the gap hours later — any intraday touch of the anchor counts.
### Partial Gap Fill (≥X%)
The **partial fill level** is user-configurable (default 50%). A partial fill is recorded when price retraces at least that percentage of the gap back toward the anchor from the opening price. For example, with a 50% setting: if the gap up is 10 points (open is 10 points above the 4:15pm close), a partial fill is recorded when price falls to within 5 points of the open (i.e. 5 points back toward the anchor). A 100% setting makes this equivalent to FULL% — a complete gap fill.
### The Three Gap Levels
The indicator captures three independent opening prices, each at a configurable time:
- **Level 1** — defaults to the **RTH open at 09:30 ET**. This is the most widely watched gap — the difference between the prior day's 4:15pm close and the next day's regular-session open.
- **Level 2** — defaults to the **03:00 ET open** (broadly the London/European futures open). This captures the gap that existed when European trading began.
- **Level 3** — defaults to the **midnight (00:00 ET) open**. This captures the initial overnight gap that formed at the start of the new calendar day.
Each level builds its own independent statistics, so you can compare how gap-fill behaviour differs across these three time windows.
### Level Quartile (LQ)
For the current session, the **level quartile** describes where the opening price of each level sits **within the gap box** — i.e. how far into the gap that level's open was relative to the full anchor-to-RTH-open range. LQ1 means the level opened very close to the RTH open (near the far edge of the gap), LQ4 means it opened very close to the anchor (near full-fill territory already).
---
## What You See on the Chart
### Gap Boxes
For each active level, a shaded box is drawn spanning from the **anchor price** to the **opening price** at that level's time. The box extends rightward through the session, stopping at 4:15pm ET. The box colour matches the level's configured colour (default: purple for Level 1, blue for Level 2, teal for Level 3). Boxes are shown only when there is a genuine gap — if the opening price equals the anchor, no box is drawn.
### Quartile Lines Inside Boxes
When enabled, three dashed/solid lines are drawn inside each gap box, dividing it into four equal price quartiles:
- **Q1 line (dashed)** — 25% of the way from the opening price toward the anchor
- **Q2 line (solid)** — the midpoint of the gap (50%)
- **Q3 line (dashed)** — 75% of the way toward the anchor
These help you gauge how far price has retraced into the gap at a glance, and they correspond to the Level Quartile (LQ) measure in the stats table.
### Opening Price Lines
A dotted line is drawn at each level's opening price for the session and extends rightward to 4:15pm, giving a persistent visual reference for where each gap began.
### Session History
The indicator keeps and displays the last N sessions (configurable, default 10). Older boxes and lines are automatically removed as new sessions are added, keeping the chart uncluttered.
---
## The Stats Table, Explained Column by Column
The stats table has one block of four rows per level. Each block breaks down the statistics for that level across the four gap-size quartile buckets.
### Row structure
Each row corresponds to one **gap size bucket** (Q1 through Q4). The row currently matching today's session is highlighted in grey.
### Columns
**LEVEL** — identifies which opening level the block belongs to (shown as the configured session string, e.g. `0930-0931`). The label is coloured to match the level's chart colour.
**GAP SIZE BUCKET (vs history)** — the quartile label for that row:
- `0–25%ile (smallest gaps)` — Q1
- `25–50%ile` — Q2
- `50–75%ile` — Q3
- `75–100%ile (largest gaps)` — Q4
**GAP UP — N** — the number of completed sessions where the gap was **up** (open above anchor) and fell in this size bucket.
**GAP UP — FULL%** — of those sessions, the percentage where price returned to the anchor at any point during RTH. This is the full gap fill rate for up-gaps of this size.
**GAP UP — ≥X%** — of those sessions, the percentage where price retraced at least the configured partial fill percentage back toward the anchor. At the default 50% setting, this is how often the market covered at least half the gap.
**GAP UP — AVG GAP** — the average gap size in points for up-gap sessions in this bucket.
**GAP DOWN — N / FULL% / ≥X% / AVG GAP** — the same four columns as above, but for sessions where the gap was **down** (open below anchor).
**CURRENT SESSION — GAP-Q / LVL-Q** — visible only on the row matching today's gap size bucket, and only when a level has fired today. Shows two numbers:
- **GQ** — the gap size quartile for today (GQ1 = smallest, GQ4 = largest)
- **LQ** — the level quartile, indicating where that level's open sits within today's overall gap box (LQ1 = close to the RTH open, LQ4 = close to the anchor)
---
## How To Configure the Indicator
### Anchor Settings
**Anchor Session (4:15pm)** — the one-minute session window used to capture the previous session's closing price. The default `1615-1616` captures the 4:15pm ET bar close. Only change this if your instrument's reference close is at a different time.
### Gap Times
These three groups configure the three independent opening levels. Each has the same three inputs:
**Level X Open Time** — a TradingView session string defining the one-minute window at which the opening price is captured. The default sessions are:
- Level 1: `0930-0931` (RTH open)
- Level 2: `0300-0301` (European open)
- Level 3: `0000-0001` (Midnight ET)
You can change any of these to any time of day. Common alternatives include the 08:30 ET futures open (`0830-0831`) or the London open (`0800-0801`). The level fires once per calendar day at the first bar inside that window, and only if the anchor has already been set.
**Level X Color** — the colour used for that level's box, lines, and table label.
**Show Level X** — master toggle. When off, the level's boxes and lines are hidden and its rows are omitted from the stats table.
### Gap Fill Stat
**Partial Fill Level (%)** — controls what counts as a partial fill, from 1% to 100%. At 50% (default), the ≥X% column in the table tracks how often price retraced at least halfway back to the anchor. Set this to 100% to track only complete fills, or to a lower value such as 25% to track more modest retracements. The column header in the table updates to reflect your chosen value (e.g. `≥50.0%`).
### Visuals
**Show Gap Boxes (per level)** — toggles the shaded gap boxes on or off for all levels. The opening-price dotted lines are still drawn when this is off.
**Show Quartile Lines Inside Boxes** — toggles the three internal Q1/Q2/Q3 division lines inside each gap box.
**Keep Last N Sessions** — how many sessions of boxes and lines to retain on the chart. Higher values give more context but can clutter the chart. Default is 10.
### Stats Table
**Position** — one of nine positions on the chart for the stats table (top/middle/bottom × left/center/right). Default is `bottom_right`.
**Text Size** — `tiny`, `small`, `normal`, or `large`. Default is `small`. Use `tiny` on smaller screens or when all three levels are shown simultaneously.
---
## Practical Tips for Interpreting the Statistics
**Focus on N first.** A FULL% or ≥X% figure is only meaningful with an adequate sample size. Rows with small N values (especially Q4, which by definition can only contain 25% of all sessions) should be read cautiously. As a general guide, treat any figure based on fewer than 20–30 sessions as directionally interesting but not statistically reliable.
**Compare up vs. down gaps.** Many instruments show different fill rates for up-gaps versus down-gaps. A market that fills up-gaps 80% of the time but down-gaps only 50% of the time has a structural asymmetry worth knowing about.
**Use the size buckets to understand context.** The quartile split reveals whether gap-fill behaviour is consistent across all gap sizes or whether it changes materially. For example, small gaps (Q1) may fill at very high rates while large gaps (Q4) fill much less often — or vice versa. Today's highlighted row tells you which regime today's gap falls into.
**The partial fill column adds nuance.** Even when FULL% is modest, the ≥50% column may be high, suggesting price often makes a meaningful but incomplete move back toward the anchor. This can be useful context for targets and stops.
**The current session column (GAP-Q / LVL-Q)** tells you at a glance where today sits historically. GQ4 / LQ2 would mean today has a historically large gap, and Level 2 opened roughly in the middle of that gap — already halfway to a fill before the RTH session began.
**Compare levels against each other.** If Level 3 (midnight open) shows a higher fill rate than Level 1 (RTH open), it may indicate that much of the gap-filling happens during the overnight and pre-market session before RTH begins. If Level 1 shows a higher fill rate, the RTH session is where fills predominantly occur.
---
## Important Limitations and Considerations
1. **Levels must fire after midnight ET.** Because the indicator resets its session state once per calendar day in Eastern Time, a level's open time must fall on or after 00:00 ET for it to be captured correctly for that calendar day. If you configure a level earlier than midnight ET (which would be the prior afternoon), it will not associate correctly with the next day's anchor. The three defaults (00:00, 03:00, 09:30) all respect this constraint.
2. **The indicator requires an anchor from the prior session.** On the very first bar of a chart's history (or after a gap in data), there is no prior 4:15pm close available and no gap is measured for that day. This is normal behaviour and those sessions are simply skipped.
3. **Gap size quartile buckets need history to calibrate.** Until at least 4 prior gaps have been recorded, all sessions are assigned to Q2. The quartile thresholds update as history grows, so the bucket assignments for earlier sessions may shift over time as more data accumulates. This is by design — the buckets are always relative to all available history, not a fixed absolute threshold.
4. **All times are Eastern Time (ET).** The indicator uses the `America/New_York` timezone for all session windows. If your chart's timezone is set differently, the session windows still fire at the correct ET times — but the visual bar positions will correspond to your chart's local timezone.
5. **The stats table only shows levels that are enabled.** If you turn off Level 2, its rows are removed from the table and its data is no longer accumulated. Stats accumulate only for sessions where a level is enabled, so disabling and re-enabling a level mid-history will cause a gap in its data.
6. **Descriptive, not predictive.** The indicator reports what has happened on your chart's history. Past fill rates do not guarantee future behaviour. A 75% full-fill rate means the gap did not fill 25% of the time. These statistics provide context, not certainty, and should be used alongside your own analysis and risk management.
7. **Not financial advice.** This is an analytical and educational tool. It does not provide buy or sell signals and makes no claim about future price direction.
---
*Gap Closure Stats computes everything from the sessions on your own chart — no external data, no hard-coded numbers. The statistics are only as reliable as the history available on your chart.*
---
## What This Indicator Does
**Gap Closure Stats** tracks the gap between each session's **4:15pm ET close** (the anchor price) and up to three configurable **opening prices** — by default the midnight open (00:00 ET), the London/European open (03:00 ET), and the RTH open (09:30 ET). For each of those levels it draws a coloured box on the chart spanning from the anchor price to the opening price, and records statistics on how often price subsequently fills that gap during the regular trading session.
Every percentage in the stats table is computed **live, from the history on your own chart**. There are no hard-coded numbers. The statistics describe exactly the instrument and timeframe you are looking at, and they update automatically as new sessions complete.
The indicator answers a core structural question about daily price behaviour:
- Given a gap of a certain size between yesterday's 4:15pm close and today's open, how often does price retrace back to that 4:15pm level (a full gap fill)?
- How often does price retrace at least a defined partial amount of the gap?
- Do these tendencies differ depending on whether the gap is up or down?
- Do they change when the gap is unusually large or small relative to recent history?
It is an analytical and contextual tool. It does not issue buy or sell signals.
---
## Core Concepts and Definitions
### The Anchor Price (4:15pm ET Close)
The reference price for each trading day is the **close of the 4:15pm ET bar** from the prior session. This is captured during a narrow one-minute anchor session (default 16:15–16:16 ET). The anchor represents where the market last traded before overnight activity begins, and it is the level that a "gap fill" requires price to return to.
### The Gap
A gap exists when the opening price at one of the three configurable levels differs from the anchor. If the opening price is **above** the anchor, the gap is **up** — price has gapped higher overnight and a fill means price would need to fall back to the anchor. If the opening price is **below** the anchor, the gap is **down** — price would need to rally back to fill it.
The **gap size** in points is the absolute difference between the anchor and the opening price.
### Gap Size Buckets (Quartiles vs. History)
Each day's gap size is classified into one of four buckets based on where it falls in the **historical distribution of all prior gaps** on your chart:
- **Q1 (0–25th percentile)** — the smallest gaps relative to history
- **Q2 (25–50th percentile)** — below-median gaps
- **Q3 (50–75th percentile)** — above-median gaps
- **Q4 (75–100th percentile)** — the largest gaps relative to history
This classification requires at least 4 prior sessions of data before it becomes meaningful. On very fresh charts, all gaps are assigned to Q2 until enough history accumulates. The bucket thresholds update as each new session completes.
### Full Gap Fill (Hit%)
A **full gap fill** (labelled **FULL%** in the table) is recorded when price trades at or through the anchor price at any point during the RTH session (09:30–16:00 ET). It does not matter whether price opens, then reverses immediately, or whether it fills the gap hours later — any intraday touch of the anchor counts.
### Partial Gap Fill (≥X%)
The **partial fill level** is user-configurable (default 50%). A partial fill is recorded when price retraces at least that percentage of the gap back toward the anchor from the opening price. For example, with a 50% setting: if the gap up is 10 points (open is 10 points above the 4:15pm close), a partial fill is recorded when price falls to within 5 points of the open (i.e. 5 points back toward the anchor). A 100% setting makes this equivalent to FULL% — a complete gap fill.
### The Three Gap Levels
The indicator captures three independent opening prices, each at a configurable time:
- **Level 1** — defaults to the **RTH open at 09:30 ET**. This is the most widely watched gap — the difference between the prior day's 4:15pm close and the next day's regular-session open.
- **Level 2** — defaults to the **03:00 ET open** (broadly the London/European futures open). This captures the gap that existed when European trading began.
- **Level 3** — defaults to the **midnight (00:00 ET) open**. This captures the initial overnight gap that formed at the start of the new calendar day.
Each level builds its own independent statistics, so you can compare how gap-fill behaviour differs across these three time windows.
### Level Quartile (LQ)
For the current session, the **level quartile** describes where the opening price of each level sits **within the gap box** — i.e. how far into the gap that level's open was relative to the full anchor-to-RTH-open range. LQ1 means the level opened very close to the RTH open (near the far edge of the gap), LQ4 means it opened very close to the anchor (near full-fill territory already).
---
## What You See on the Chart
### Gap Boxes
For each active level, a shaded box is drawn spanning from the **anchor price** to the **opening price** at that level's time. The box extends rightward through the session, stopping at 4:15pm ET. The box colour matches the level's configured colour (default: purple for Level 1, blue for Level 2, teal for Level 3). Boxes are shown only when there is a genuine gap — if the opening price equals the anchor, no box is drawn.
### Quartile Lines Inside Boxes
When enabled, three dashed/solid lines are drawn inside each gap box, dividing it into four equal price quartiles:
- **Q1 line (dashed)** — 25% of the way from the opening price toward the anchor
- **Q2 line (solid)** — the midpoint of the gap (50%)
- **Q3 line (dashed)** — 75% of the way toward the anchor
These help you gauge how far price has retraced into the gap at a glance, and they correspond to the Level Quartile (LQ) measure in the stats table.
### Opening Price Lines
A dotted line is drawn at each level's opening price for the session and extends rightward to 4:15pm, giving a persistent visual reference for where each gap began.
### Session History
The indicator keeps and displays the last N sessions (configurable, default 10). Older boxes and lines are automatically removed as new sessions are added, keeping the chart uncluttered.
---
## The Stats Table, Explained Column by Column
The stats table has one block of four rows per level. Each block breaks down the statistics for that level across the four gap-size quartile buckets.
### Row structure
Each row corresponds to one **gap size bucket** (Q1 through Q4). The row currently matching today's session is highlighted in grey.
### Columns
**LEVEL** — identifies which opening level the block belongs to (shown as the configured session string, e.g. `0930-0931`). The label is coloured to match the level's chart colour.
**GAP SIZE BUCKET (vs history)** — the quartile label for that row:
- `0–25%ile (smallest gaps)` — Q1
- `25–50%ile` — Q2
- `50–75%ile` — Q3
- `75–100%ile (largest gaps)` — Q4
**GAP UP — N** — the number of completed sessions where the gap was **up** (open above anchor) and fell in this size bucket.
**GAP UP — FULL%** — of those sessions, the percentage where price returned to the anchor at any point during RTH. This is the full gap fill rate for up-gaps of this size.
**GAP UP — ≥X%** — of those sessions, the percentage where price retraced at least the configured partial fill percentage back toward the anchor. At the default 50% setting, this is how often the market covered at least half the gap.
**GAP UP — AVG GAP** — the average gap size in points for up-gap sessions in this bucket.
**GAP DOWN — N / FULL% / ≥X% / AVG GAP** — the same four columns as above, but for sessions where the gap was **down** (open below anchor).
**CURRENT SESSION — GAP-Q / LVL-Q** — visible only on the row matching today's gap size bucket, and only when a level has fired today. Shows two numbers:
- **GQ** — the gap size quartile for today (GQ1 = smallest, GQ4 = largest)
- **LQ** — the level quartile, indicating where that level's open sits within today's overall gap box (LQ1 = close to the RTH open, LQ4 = close to the anchor)
---
## How To Configure the Indicator
### Anchor Settings
**Anchor Session (4:15pm)** — the one-minute session window used to capture the previous session's closing price. The default `1615-1616` captures the 4:15pm ET bar close. Only change this if your instrument's reference close is at a different time.
### Gap Times
These three groups configure the three independent opening levels. Each has the same three inputs:
**Level X Open Time** — a TradingView session string defining the one-minute window at which the opening price is captured. The default sessions are:
- Level 1: `0930-0931` (RTH open)
- Level 2: `0300-0301` (European open)
- Level 3: `0000-0001` (Midnight ET)
You can change any of these to any time of day. Common alternatives include the 08:30 ET futures open (`0830-0831`) or the London open (`0800-0801`). The level fires once per calendar day at the first bar inside that window, and only if the anchor has already been set.
**Level X Color** — the colour used for that level's box, lines, and table label.
**Show Level X** — master toggle. When off, the level's boxes and lines are hidden and its rows are omitted from the stats table.
### Gap Fill Stat
**Partial Fill Level (%)** — controls what counts as a partial fill, from 1% to 100%. At 50% (default), the ≥X% column in the table tracks how often price retraced at least halfway back to the anchor. Set this to 100% to track only complete fills, or to a lower value such as 25% to track more modest retracements. The column header in the table updates to reflect your chosen value (e.g. `≥50.0%`).
### Visuals
**Show Gap Boxes (per level)** — toggles the shaded gap boxes on or off for all levels. The opening-price dotted lines are still drawn when this is off.
**Show Quartile Lines Inside Boxes** — toggles the three internal Q1/Q2/Q3 division lines inside each gap box.
**Keep Last N Sessions** — how many sessions of boxes and lines to retain on the chart. Higher values give more context but can clutter the chart. Default is 10.
### Stats Table
**Position** — one of nine positions on the chart for the stats table (top/middle/bottom × left/center/right). Default is `bottom_right`.
**Text Size** — `tiny`, `small`, `normal`, or `large`. Default is `small`. Use `tiny` on smaller screens or when all three levels are shown simultaneously.
---
## Practical Tips for Interpreting the Statistics
**Focus on N first.** A FULL% or ≥X% figure is only meaningful with an adequate sample size. Rows with small N values (especially Q4, which by definition can only contain 25% of all sessions) should be read cautiously. As a general guide, treat any figure based on fewer than 20–30 sessions as directionally interesting but not statistically reliable.
**Compare up vs. down gaps.** Many instruments show different fill rates for up-gaps versus down-gaps. A market that fills up-gaps 80% of the time but down-gaps only 50% of the time has a structural asymmetry worth knowing about.
**Use the size buckets to understand context.** The quartile split reveals whether gap-fill behaviour is consistent across all gap sizes or whether it changes materially. For example, small gaps (Q1) may fill at very high rates while large gaps (Q4) fill much less often — or vice versa. Today's highlighted row tells you which regime today's gap falls into.
**The partial fill column adds nuance.** Even when FULL% is modest, the ≥50% column may be high, suggesting price often makes a meaningful but incomplete move back toward the anchor. This can be useful context for targets and stops.
**The current session column (GAP-Q / LVL-Q)** tells you at a glance where today sits historically. GQ4 / LQ2 would mean today has a historically large gap, and Level 2 opened roughly in the middle of that gap — already halfway to a fill before the RTH session began.
**Compare levels against each other.** If Level 3 (midnight open) shows a higher fill rate than Level 1 (RTH open), it may indicate that much of the gap-filling happens during the overnight and pre-market session before RTH begins. If Level 1 shows a higher fill rate, the RTH session is where fills predominantly occur.
---
## Important Limitations and Considerations
1. **Levels must fire after midnight ET.** Because the indicator resets its session state once per calendar day in Eastern Time, a level's open time must fall on or after 00:00 ET for it to be captured correctly for that calendar day. If you configure a level earlier than midnight ET (which would be the prior afternoon), it will not associate correctly with the next day's anchor. The three defaults (00:00, 03:00, 09:30) all respect this constraint.
2. **The indicator requires an anchor from the prior session.** On the very first bar of a chart's history (or after a gap in data), there is no prior 4:15pm close available and no gap is measured for that day. This is normal behaviour and those sessions are simply skipped.
3. **Gap size quartile buckets need history to calibrate.** Until at least 4 prior gaps have been recorded, all sessions are assigned to Q2. The quartile thresholds update as history grows, so the bucket assignments for earlier sessions may shift over time as more data accumulates. This is by design — the buckets are always relative to all available history, not a fixed absolute threshold.
4. **All times are Eastern Time (ET).** The indicator uses the `America/New_York` timezone for all session windows. If your chart's timezone is set differently, the session windows still fire at the correct ET times — but the visual bar positions will correspond to your chart's local timezone.
5. **The stats table only shows levels that are enabled.** If you turn off Level 2, its rows are removed from the table and its data is no longer accumulated. Stats accumulate only for sessions where a level is enabled, so disabling and re-enabling a level mid-history will cause a gap in its data.
6. **Descriptive, not predictive.** The indicator reports what has happened on your chart's history. Past fill rates do not guarantee future behaviour. A 75% full-fill rate means the gap did not fill 25% of the time. These statistics provide context, not certainty, and should be used alongside your own analysis and risk management.
7. **Not financial advice.** This is an analytical and educational tool. It does not provide buy or sell signals and makes no claim about future price direction.
---
*Gap Closure Stats computes everything from the sessions on your own chart — no external data, no hard-coded numbers. The statistics are only as reliable as the history available on your chart.*
版本注释
Fixed three bugs reported by users: (1) the FULL% fill statistic always showed 0% due to Pine Script integer-division truncation in the percentage calculation;
(2) the stats table threw a runtime error when the current session's gap bucket wasn't the first row, because the code tried to write into a table cell that had already been merged into another cell;
and (3) all three gap levels (9:30am, 3am, midnight) were showing identical hit-rate and fill-rate statistics because touch/fill detection was only ever computed against the 9:30 gap and then applied to all three levels — each level now tracks its own gap, direction, historical size bucket, touch flag, and partial-fill flag independently.
Also removed a dead anc_lines array that was declared and extended every bar but never actually used to draw anything.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。