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が提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。