OPEN-SOURCE SCRIPT
Return Distribution [ThetaLoop]

What it does
Calculates rolling Skewness and Excess Kurtosis of price returns over a configurable window. Pure statistics from price data — no indicators, no curve-fitting, no external data needed. Works on any symbol.
Skewness measures whether returns are tilted left (more downside outliers) or right (more upside outliers).
Kurtosis measures whether the return distribution has fat tails (extreme moves happen more often than a bell curve predicts) or thin tails.
Why this matters for options sellers
If you sell puts, your risk is in the left tail. Two numbers tell you how dangerous that tail currently is:
Negative Skewness means the left tail is fatter than the right. Downside outliers are occurring more frequently than upside ones. Your short puts have a higher probability of being tested.
High Kurtosis (excess above zero) means extreme moves in BOTH directions are more frequent than normal. The return distribution has fat tails. Your expected max loss is larger than a normal distribution suggests.
When both combine — negative skew AND high kurtosis — you are in a regime where selling options carries elevated tail risk. The info table shows a combined risk label (LOW RISK / CAUTION / HIGH RISK) based on both metrics together.
How to read it
Excess Kurtosis (main line):
Below 1.5 — Normal tails. Return distribution behaves roughly like a bell curve. Standard risk.
1.5 to 3.0 — Elevated. Tails are getting fatter. Extreme moves more likely than usual.
Above 3.0 — Fat tails. The distribution is far from normal. Tail risk is significantly elevated.
Skewness (secondary line):
Above -0.5 — Roughly symmetric or right-skewed. No unusual downside bias.
-0.5 to -1.0 — Mild left skew. Downside outliers are slightly overrepresented.
Below -1.0 — Heavy left skew. The return distribution is stretched to the downside.
Combined risk table (top right):
LOW RISK — Normal kurtosis, symmetric distribution. Standard environment for selling premium.
CAUTION — Either elevated kurtosis or mild negative skew. Worth monitoring position size.
HIGH RISK — Fat tails combined with negative skew. Worst regime for short options.
Recommended use
Apply to individual stocks before selling puts. A stock with Kurtosis above 3 and Skewness below -1 has a return profile that punishes option sellers disproportionately — the premium you collect does not adequately compensate for the tail risk.
Apply to SPY or QQQ as a market-wide regime monitor. When broad market kurtosis rises, it affects all correlated positions simultaneously.
Compare the same stock across different time windows (20d vs 60d vs 120d) to see whether tail risk is building or fading.
Settings
Lookback Period — Default 60 trading days (about 3 months). Shorter windows (20-30) react faster but are noisier. Longer windows (120-252) give a more stable structural reading.
Return Type — Log returns (default, standard in quantitative finance) or Simple percentage returns.
Kurtosis and Skewness thresholds — Adjustable alert and warning levels. Defaults calibrated for equity markets.
Display mode — Show both metrics, or isolate Kurtosis or Skewness individually.
Technical notes
Skewness uses the sample-corrected formula: [n / ((n-1)(n-2))] * sum((x-mu)/s)^3
Excess Kurtosis uses the sample-corrected formula with the Fisher correction term, so that a normal distribution reads zero (not 3).
Both formulas match standard statistical packages (scipy, R, Excel SKEW/KURT).
Alerts included
High Risk Regime — Fat tails combined with negative skew (worst case for short options)
Fat Tails Detected — Kurtosis above alert threshold
Heavy Left Skew — Skewness deeply negative
Limitations
This indicator measures the recent statistical shape of returns. It does NOT predict future returns or future volatility. A stock can have normal kurtosis today and fat tails tomorrow after an earnings surprise. Use as a regime filter, not a crystal ball.
The rolling window creates lag — a single extreme day takes the full lookback period to wash out of the calculation. This is by design (stability over reactivity), but be aware of it.
Calculates rolling Skewness and Excess Kurtosis of price returns over a configurable window. Pure statistics from price data — no indicators, no curve-fitting, no external data needed. Works on any symbol.
Skewness measures whether returns are tilted left (more downside outliers) or right (more upside outliers).
Kurtosis measures whether the return distribution has fat tails (extreme moves happen more often than a bell curve predicts) or thin tails.
Why this matters for options sellers
If you sell puts, your risk is in the left tail. Two numbers tell you how dangerous that tail currently is:
Negative Skewness means the left tail is fatter than the right. Downside outliers are occurring more frequently than upside ones. Your short puts have a higher probability of being tested.
High Kurtosis (excess above zero) means extreme moves in BOTH directions are more frequent than normal. The return distribution has fat tails. Your expected max loss is larger than a normal distribution suggests.
When both combine — negative skew AND high kurtosis — you are in a regime where selling options carries elevated tail risk. The info table shows a combined risk label (LOW RISK / CAUTION / HIGH RISK) based on both metrics together.
How to read it
Excess Kurtosis (main line):
Below 1.5 — Normal tails. Return distribution behaves roughly like a bell curve. Standard risk.
1.5 to 3.0 — Elevated. Tails are getting fatter. Extreme moves more likely than usual.
Above 3.0 — Fat tails. The distribution is far from normal. Tail risk is significantly elevated.
Skewness (secondary line):
Above -0.5 — Roughly symmetric or right-skewed. No unusual downside bias.
-0.5 to -1.0 — Mild left skew. Downside outliers are slightly overrepresented.
Below -1.0 — Heavy left skew. The return distribution is stretched to the downside.
Combined risk table (top right):
LOW RISK — Normal kurtosis, symmetric distribution. Standard environment for selling premium.
CAUTION — Either elevated kurtosis or mild negative skew. Worth monitoring position size.
HIGH RISK — Fat tails combined with negative skew. Worst regime for short options.
Recommended use
Apply to individual stocks before selling puts. A stock with Kurtosis above 3 and Skewness below -1 has a return profile that punishes option sellers disproportionately — the premium you collect does not adequately compensate for the tail risk.
Apply to SPY or QQQ as a market-wide regime monitor. When broad market kurtosis rises, it affects all correlated positions simultaneously.
Compare the same stock across different time windows (20d vs 60d vs 120d) to see whether tail risk is building or fading.
Settings
Lookback Period — Default 60 trading days (about 3 months). Shorter windows (20-30) react faster but are noisier. Longer windows (120-252) give a more stable structural reading.
Return Type — Log returns (default, standard in quantitative finance) or Simple percentage returns.
Kurtosis and Skewness thresholds — Adjustable alert and warning levels. Defaults calibrated for equity markets.
Display mode — Show both metrics, or isolate Kurtosis or Skewness individually.
Technical notes
Skewness uses the sample-corrected formula: [n / ((n-1)(n-2))] * sum((x-mu)/s)^3
Excess Kurtosis uses the sample-corrected formula with the Fisher correction term, so that a normal distribution reads zero (not 3).
Both formulas match standard statistical packages (scipy, R, Excel SKEW/KURT).
Alerts included
High Risk Regime — Fat tails combined with negative skew (worst case for short options)
Fat Tails Detected — Kurtosis above alert threshold
Heavy Left Skew — Skewness deeply negative
Limitations
This indicator measures the recent statistical shape of returns. It does NOT predict future returns or future volatility. A stock can have normal kurtosis today and fat tails tomorrow after an earnings surprise. Use as a regime filter, not a crystal ball.
The rolling window creates lag — a single extreme day takes the full lookback period to wash out of the calculation. This is by design (stability over reactivity), but be aware of it.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
ThetaLoop | Algorithmic Options Research
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
ThetaLoop | Algorithmic Options Research
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。