OPEN-SOURCE SCRIPT
已更新 CVR Earnings Window Filter

What It Does
The indicator answers a single practical question on every chart: how close is the next earnings event, and does that proximity matter for my trading decision?
It calculates the number of calendar days between right now and the next scheduled earnings release using TradingView's built-in earnings.future_time variable, which holds the Unix timestamp of the next announced earnings date for the current symbol.
Inputs
ParameterDefaultRangeDescriptionN — days until earnings51–60Width of the earnings window in calendar daysFilter modeAvoid window—Controls which condition is a pass
Core Calculation
days_until = floor( (earnings.future_time − timenow) / 86,400,000 )
Floored to full calendar days. Earnings day itself is always day 0 and is always excluded from the window. The active window is the interval [1, N].
days_untilMeaningnaNo earnings date on file for this symbol0Earnings today — excluded from window1Earnings tomorrow — first day inside window> NOutside window — far enough from earnings
Filter Modes
Avoid Window — passes = true when the symbol is outside the window. Enforces a pre-earnings blackout zone (e.g. no new entries within 5 days of a report). Symbols with no date on file (na) pass as safe.
Target Window — passes = true when the symbol is inside the window. Surfaces stocks approaching an earnings catalyst for pre-earnings setup hunting.
Visual Output
Blue step-line — raw days_until value per bar
Dashed line at N — outer boundary; when the line crosses below, the window is active
Dotted lines at 1 and 0 — inner boundaries marking the earnings day itself
Orange background — active whenever the window is open (1 ≤ days_until ≤ N)
Label on last bar — green if the symbol passes the active mode, red if blocked
Edge Cases
No date (na): Avoid mode passes, Target mode blocks
Earnings today (0): outside the window in both modes — the earnings day is never included
Calendar vs. trading days: the calculation uses raw calendar days; a Monday report shows 2 on Friday, not 1
Data accuracy: depends on whether TradingView has a confirmed date; unconfirmed estimates may differ from the actual report
The indicator answers a single practical question on every chart: how close is the next earnings event, and does that proximity matter for my trading decision?
It calculates the number of calendar days between right now and the next scheduled earnings release using TradingView's built-in earnings.future_time variable, which holds the Unix timestamp of the next announced earnings date for the current symbol.
Inputs
ParameterDefaultRangeDescriptionN — days until earnings51–60Width of the earnings window in calendar daysFilter modeAvoid window—Controls which condition is a pass
Core Calculation
days_until = floor( (earnings.future_time − timenow) / 86,400,000 )
Floored to full calendar days. Earnings day itself is always day 0 and is always excluded from the window. The active window is the interval [1, N].
days_untilMeaningnaNo earnings date on file for this symbol0Earnings today — excluded from window1Earnings tomorrow — first day inside window> NOutside window — far enough from earnings
Filter Modes
Avoid Window — passes = true when the symbol is outside the window. Enforces a pre-earnings blackout zone (e.g. no new entries within 5 days of a report). Symbols with no date on file (na) pass as safe.
Target Window — passes = true when the symbol is inside the window. Surfaces stocks approaching an earnings catalyst for pre-earnings setup hunting.
Visual Output
Blue step-line — raw days_until value per bar
Dashed line at N — outer boundary; when the line crosses below, the window is active
Dotted lines at 1 and 0 — inner boundaries marking the earnings day itself
Orange background — active whenever the window is open (1 ≤ days_until ≤ N)
Label on last bar — green if the symbol passes the active mode, red if blocked
Edge Cases
No date (na): Avoid mode passes, Target mode blocks
Earnings today (0): outside the window in both modes — the earnings day is never included
Calendar vs. trading days: the calculation uses raw calendar days; a Monday report shows 2 on Friday, not 1
Data accuracy: depends on whether TradingView has a confirmed date; unconfirmed estimates may differ from the actual report
版本注释
none开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。