Quarterly Earnings - v1This script shows company fundamentals in a TradingView table: Earnings Per Share (EPS), Price-to-Earnings Ratio (P/E, TTM), Sales (in Crores), Operating Margin (OPM %), Return on Assets (ROA %), and Return on Equity (ROE %).
Earningsreport
Aftershock Playbook: Stock Earnings Drift EngineStrategy type 
Event-driven post-earnings momentum engine (long/short) built for single-stock charts or ADRs that publish quarterly results.
 What it does 
Detects the exact earnings bar (request.earnings, lookahead_off).
Scores the surprise and launches a position on that candle’s close.
Tracks PnL: if the first leg closes green, the engine automatically re-enters on the very next bar, milking residual drift.
Blocks mid-cycle trades after a loss until the next earnings release—keeping the risk contained to one cycle.
Think of it as a sniper that fires on the earnings pop, reloads once if the shot lands, then goes silent until the next report.
 Core signal inputs 
Component	Default	Purpose
EPS Surprise %	+0 % / –5 %	Minimum positive / negative shock to trigger longs/shorts.
Reverse signals?	Off	Quick flip for mean-reversion experiments.
Time Risk Mgt.	Off	Optional hard exit after 45 calendar days (auto-scaled to any TF).
 Risk engine 
ATR-based stop (ATR × 2 by default, editable).
Bar time stop (15-min → Daily: Have to select the bar value ).
No pyramiding beyond the built-in “double-tap”.
All positions sized as % of equity via Strategy Properties.
 Visual aids
 Yellow triangle marks the earnings bar.
Diagnostics table (top-right) shows last Actual, Estimate, and Surprise %.
Status-line tool-tips on every input.
 Default inputs 
Setting	Value
Positive surprise ≥	0 %
Negative surprise ≤	–5 %
ATR stop ×	2
ATR length	50
Hold horizon	350 ( 1h timeframe chart bars)
 Back-test properties 
Initial capital  10 000
Order size    5 % of equity
Pyramiding    1 (internal re-entry only)
Commission   0.03 %
Slippage     5 ticks
Fills      Bar magnifier ✔ · On bar close ✔ · Standard OHLC ✔
 How to use 
Add the script to any earnings-driven stock (AAPL, MSFT, TSLA…).
Turn on Time Risk Management if you want stricter risk management
Back-test different ATR multipliers to fit the stock’s volatility.
Sync commission & slippage with your broker before forward-testing.
 Important notes 
Works on every timeframe from 15 min to 1 D. Sweet spot around 30min/1h
All request.earnings() & request.security() calls use lookahead_off—zero repaint.
The “double-tap” re-entry occurs once per winning cycle to avoid drift-chasing loops.
Historical stats ≠ future performance. Size positions responsibly.

