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. اقرأ المزيد في شروط الاستخدام.