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
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
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/
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
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/
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.