OPEN-SOURCE SCRIPT
Jensen's Convexity Score

The Jensen Convexity Score is a quantitative indicator that measures asymmetric volatility patterns in asset returns, identifying securities with positive convexity (higher upside volatility than downside volatility).
It's based on Jensen's inequality from probability theory and it helps investors to identify assets with favorable risk-return asymmetries.
I was inspired to write this indicator while reading the book "The Statistical Consequences of Fat Tails by Nassim Nicholas Taleb.
"The payoff of a human venture is, in general, inversely proportional to what it is expected to be... Convexity is one way to remedy the problem of prediction." Nassim Nicholas Taleb
Jensen's Inequality
Jensen's inequality states that for a convex function f and random variable X:
E[f(X)] ≥ f(E[X])
For concave functions, the inequality reverses. This fundamental principle reveals that:

The Convexity Score Formula
The indicator calculates a normalized convexity score by comparing upside and downside volatility. It's a simple but beautiful expression:
Convexity Score = [(σ_up)² - (σ_down)²] / (σ_total)² × 100
Where:
- σ_up = Standard deviation of positive log returns
- σ_down = Standard deviation of negative log returns
- σ_total = Standard deviation of all log returns
Interpretation:
How The Indicator Works - Core Calculation
Step 1: Return Separation
- Computes log returns over a lookback period (default: 50 and 120 bars)
- Separates returns into upside moves (positive) and downside moves (negative)
Step 2: Volatility Measurement
- Calculates standard deviation for upside returns (σ_up)
- Calculates standard deviation for downside returns (σ_down)
- Calculates total volatility (σ_total)
Step 3: Score Normalization
- Computes convexity score as variance ratio
- Multiplies by 100 for percentage display
- Calculates historical percentile ranking (252-bar lookback)
Step 4: Momentum Analysis
- Linear regression slope on 20-bar score history
- Identifies improving vs deteriorating convexity patterns

Use Cases
Asset Screening & Selection
Scan multiple stocks to identify:
- High positive convexity (score > +25): Assets with asymmetric upside potential
- High negative convexity (score < -25): Assets to avoid or hedge
Portfolio Construction
- Overweight assets with persistent positive convexity
- Underweight or hedge assets with persistent negative convexity
- Build "barbell" portfolios: safe assets + high convexity opportunities
Risk Management
- Deteriorating convexity (score declining, negative momentum): Early warning signal
- Extreme negative readings (< -40): Potential tail risk, reduce exposure
- Improving convexity (score rising, positive momentum): Building positive asymmetry
Market Regime Analysis
- High average convexity: Risk-on environment, growth favored
- Low/negative convexity: Risk-off environment, defensive positioning
Interpretation Guide
Strong Buy Signals (Score > +25)" Upside volatility significantly exceeds downside
Buy Signals (Score +10 to +25): Moderate positive asymmetry
Neutral (Score -10 to +10): Symmetric volatility profile
Caution Signals (Score -25 to -10): Downside volatility exceeds upside
Avoid/Hedge Signals (Score < -25): Strong negative convexity
Why Convexity Matters
Nassim Taleb emphasizes that in an uncertain world, convexity is more valuable than prediction: "If you have favorable asymmetries, or positive convexity, options being a special case, then in the long run you will do reasonably well, outperforming the average in the presence of uncertainty."
Traditional risk metrics (Sharpe ratio, volatility) assume symmetric distributions. The Jensen Convexity Score reveals the hidden structure:
- Positive convexity: Benefits from volatility (antifragile)
- Negative convexity: Harmed by volatility (fragile)
Let me know if you have any suggestions :)
- Henrique Centieiro
It's based on Jensen's inequality from probability theory and it helps investors to identify assets with favorable risk-return asymmetries.
I was inspired to write this indicator while reading the book "The Statistical Consequences of Fat Tails by Nassim Nicholas Taleb.
"The payoff of a human venture is, in general, inversely proportional to what it is expected to be... Convexity is one way to remedy the problem of prediction." Nassim Nicholas Taleb
Jensen's Inequality
Jensen's inequality states that for a convex function f and random variable X:
E[f(X)] ≥ f(E[X])
For concave functions, the inequality reverses. This fundamental principle reveals that:
- Convex payoffs benefit from volatility (options, venture capital, growth stocks)
- Concave payoffs suffer from volatility (short options, leveraged positions, meme stocks)
The Convexity Score Formula
The indicator calculates a normalized convexity score by comparing upside and downside volatility. It's a simple but beautiful expression:
Convexity Score = [(σ_up)² - (σ_down)²] / (σ_total)² × 100
Where:
- σ_up = Standard deviation of positive log returns
- σ_down = Standard deviation of negative log returns
- σ_total = Standard deviation of all log returns
Interpretation:
- Positive scores (+10 to +50+): Upside volatility exceeds downside volatility → Convex opportunity
- Negative scores (-10 to -50+): Downside volatility exceeds upside volatility → Concave risk
- Near zero (-10 to +10): Symmetric volatility → Gaussian-like behavior
How The Indicator Works - Core Calculation
Step 1: Return Separation
- Computes log returns over a lookback period (default: 50 and 120 bars)
- Separates returns into upside moves (positive) and downside moves (negative)
Step 2: Volatility Measurement
- Calculates standard deviation for upside returns (σ_up)
- Calculates standard deviation for downside returns (σ_down)
- Calculates total volatility (σ_total)
Step 3: Score Normalization
- Computes convexity score as variance ratio
- Multiplies by 100 for percentage display
- Calculates historical percentile ranking (252-bar lookback)
Step 4: Momentum Analysis
- Linear regression slope on 20-bar score history
- Identifies improving vs deteriorating convexity patterns
Use Cases
Asset Screening & Selection
Scan multiple stocks to identify:
- High positive convexity (score > +25): Assets with asymmetric upside potential
- High negative convexity (score < -25): Assets to avoid or hedge
Portfolio Construction
- Overweight assets with persistent positive convexity
- Underweight or hedge assets with persistent negative convexity
- Build "barbell" portfolios: safe assets + high convexity opportunities
Risk Management
- Deteriorating convexity (score declining, negative momentum): Early warning signal
- Extreme negative readings (< -40): Potential tail risk, reduce exposure
- Improving convexity (score rising, positive momentum): Building positive asymmetry
Market Regime Analysis
- High average convexity: Risk-on environment, growth favored
- Low/negative convexity: Risk-off environment, defensive positioning
Interpretation Guide
Strong Buy Signals (Score > +25)" Upside volatility significantly exceeds downside
Buy Signals (Score +10 to +25): Moderate positive asymmetry
Neutral (Score -10 to +10): Symmetric volatility profile
Caution Signals (Score -25 to -10): Downside volatility exceeds upside
Avoid/Hedge Signals (Score < -25): Strong negative convexity
Why Convexity Matters
Nassim Taleb emphasizes that in an uncertain world, convexity is more valuable than prediction: "If you have favorable asymmetries, or positive convexity, options being a special case, then in the long run you will do reasonably well, outperforming the average in the presence of uncertainty."
Traditional risk metrics (Sharpe ratio, volatility) assume symmetric distributions. The Jensen Convexity Score reveals the hidden structure:
- Positive convexity: Benefits from volatility (antifragile)
- Negative convexity: Harmed by volatility (fragile)
Let me know if you have any suggestions :)
- Henrique Centieiro
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Hedge Fund Manager at Maverick Capital | Wealth Educator | 20+ yrs investing | Stocks, ETFs & Crypto alerts | Join Henrique Wealth Academy for trade alerts & indicators → skool.com/be-limitless/
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Hedge Fund Manager at Maverick Capital | Wealth Educator | 20+ yrs investing | Stocks, ETFs & Crypto alerts | Join Henrique Wealth Academy for trade alerts & indicators → skool.com/be-limitless/
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.