OPEN-SOURCE SCRIPT

Earnings Day - Price Predictor [DunesIsland]

71
It's designed to analyze and visualize historical stock price movements on earnings report days, focusing on percentage changes.
Here's a breakdown of what it does, step by step:


Key Inputs and Setup
  • User Input: There's a single input for "Lookback Years" (default: 10), which determines how far back in time (approximately) the indicator analyzes earnings data. It uses a rough calculation of milliseconds in that period to filter historical data.
  • Data Fetching: It uses TradingView's request.earnings function to pull actual earnings per share (EPS) data for the current ticker. Earnings days are identified where EPS data exists on a bar but not on the previous one (to avoid duplicates).
  • Price Change Calculation: For each detected earnings day, it computes the percentage price movement as (close - close[1]) / close[1] * 100, representing the change from the previous close to the current close on that day.

Processing and Calculations (on the Last Bar)
  • Lookback Filter: It calculates a cutoff timestamp for the lookback period and processes only earnings events within that window.

Overall Averages:
  • Separates positive (≥0%) and negative (<0%) percentage changes.

Seasonality (Next Quarter Prediction):
  • Identifies the most recent earnings quarter (latest_q).
  • Predicts the "next" quarter (e.g., if latest is Q4, next is Q1;
  • Again, separates positive and negative changes, computing their respective averages.

Visual Outputs
  • Lookback: How far to fetch the data in years.
  • Average Change (Green): Showing the average of all positive changes.
  • Average Change (Red): Showing the average of all negative changes.
  • Seasonality Change (Green): Showing the average of positive changes for the predicted next quarter.
  • Seasonality Change (Red): Showing the average of negative changes for the predicted next quarter.

Purpose and Usage

This indicator helps traders assess a stock's historical reaction to earnings announcements. The overall averages give a broad sense of typical gains/losses, while the seasonality focuses on quarter-specific trends to "predict" potential movement for the upcoming earnings (based on past same-quarter performance). It's best used on daily charts for stocks with reliable earnings data. Note that quarter inference is calendar-based and may not perfectly match fiscal calendars for all companies—it's an approximation.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.