OPEN-SOURCE SCRIPT
Volatility Managed Kelly Leverage

The Volatility Managed Kelly Leverage (VMKL) indicator is a tool that dynamically adjusts position sizing based on forecasted market volatility. It helps you to optimize leverage exposure by systematically reducing risk during high volatility periods and increasing exposure when markets are calm.
VMKL adapts in real-time to changing market conditions, potentially generating alpha while smoothing volatility and reducing maximum drawdown.
This indicator implements the Optimal Volatility Plus Mean Strategy (OVPMS) from one of my favorite leverage papers:
"Alpha Generation and Risk Smoothing using Managed Volatility" by Tony Cooper (2010)
These are the key findings from the paper, which this indicator translates to real life:
The indicator calculates optimal leverage using a three-step process
1. Volatility Forecasting
Uses Exponential Weighted Moving Average (EWMA):
σ²(t) = λ·σ²(t-1) + (1-λ)·r²(t-1)
This predicts next-day volatility from recent price movements
2. Return Prediction
Expected Return = a × σ^(b+1)
Where:
The negative exponent means returns decrease as volatility increases - a well-documented market behaviour.
3. Optimal Leverage Calculation
Full Kelly Leverage = μ / σ²
Actual Leverage = Full Kelly × Kelly Fraction × Caps × Smoothing
The Kelly Criterion provides the theoretically optimal leverage, which is then reduced via:
The Core Insight: Volatility varies over time (volatility of volatility), and this variation is costly. By targeting consistent volatility through dynamic leverage:
The indicator calculates optimal leverage in real-time using EWMA volatility forecasting and Kelly Criterion mathematics, automatically detecting market regimes from CASH to VERY AGGRESSIVE and respective leverages. The statistics table shows Full Kelly leverage, Kelly Fraction leverage, forecasted volatility, predicted returns, and current regime.
Settings Guide
Please check the informational "i" in setting to get a lot more info.
You can also use preset configurations:
Conservative (Safe)
Kelly Fraction: 0.50
Max Leverage: 2.0x
Lambda: 0.97
Sensitivity: Enhanced
Moderate (Balanced) ⭐ DEFAULT
Kelly Fraction: 0.75
Max Leverage: 3.0x
Lambda: 0.94
Sensitivity: Enhanced
Aggressive (Maximum)
Kelly Fraction: 1.0
Max Leverage: 5.0x
Lambda: 0.90
Sensitivity: Standard
Paper Replication (Academic)
Kelly Fraction: 1.0
Max Leverage: 3.0x
Lambda: 0.94
Sensitivity: Standard
Adaptive: ON
Smoothing: 1
Remember: LEVERAGE MAGNIFIES BOTH GAINS AND LOSSES
Let me know if you have questions!
By Henrique Centieiro
VMKL adapts in real-time to changing market conditions, potentially generating alpha while smoothing volatility and reducing maximum drawdown.
This indicator implements the Optimal Volatility Plus Mean Strategy (OVPMS) from one of my favorite leverage papers:
"Alpha Generation and Risk Smoothing using Managed Volatility" by Tony Cooper (2010)
These are the key findings from the paper, which this indicator translates to real life:
- Volatility is predictable while returns are not
- Dynamic leverage based on volatility forecasts can generate significant excess returns
- The strategy reduces volatility of volatility (vovo), kurtosis, and maximum drawdown
- Tested on 125+ years of market data across multiple global indices
- The OVPMS strategy (translated into this indicator) returned 12.6% annual return vs 7.0% for buy-and-hold, with the same volatility as the underlying index. Outstanding.
The indicator calculates optimal leverage using a three-step process
1. Volatility Forecasting
Uses Exponential Weighted Moving Average (EWMA):
σ²(t) = λ·σ²(t-1) + (1-λ)·r²(t-1)
This predicts next-day volatility from recent price movements
2. Return Prediction
Expected Return = a × σ^(b+1)
Where:
- a = Power coefficient (baseline return, default: 0.10)
- b = Power exponent (return-volatility relationship, default: -1.76 for SPY)
- σ = Forecasted volatility
The negative exponent means returns decrease as volatility increases - a well-documented market behaviour.
3. Optimal Leverage Calculation
Full Kelly Leverage = μ / σ²
Actual Leverage = Full Kelly × Kelly Fraction × Caps × Smoothing
The Kelly Criterion provides the theoretically optimal leverage, which is then reduced via:
- Kelly Fraction: Safety margin (default 75% = three-quarter Kelly)
- Leverage Caps: Hard maximum and minimum limits
- Smoothing: SMA to reduce rebalancing frequency
The Core Insight: Volatility varies over time (volatility of volatility), and this variation is costly. By targeting consistent volatility through dynamic leverage:
- Reduces volatility drag - Compounding works better with stable volatility
- Reduces drawdowns - Automatically deleverages before crashes
- Reduces kurtosis - Fewer extreme return events
- Generates alpha - Exploits the return-volatility relationship
The indicator calculates optimal leverage in real-time using EWMA volatility forecasting and Kelly Criterion mathematics, automatically detecting market regimes from CASH to VERY AGGRESSIVE and respective leverages. The statistics table shows Full Kelly leverage, Kelly Fraction leverage, forecasted volatility, predicted returns, and current regime.
Settings Guide
Please check the informational "i" in setting to get a lot more info.
You can also use preset configurations:
Conservative (Safe)
Kelly Fraction: 0.50
Max Leverage: 2.0x
Lambda: 0.97
Sensitivity: Enhanced
Moderate (Balanced) ⭐ DEFAULT
Kelly Fraction: 0.75
Max Leverage: 3.0x
Lambda: 0.94
Sensitivity: Enhanced
Aggressive (Maximum)
Kelly Fraction: 1.0
Max Leverage: 5.0x
Lambda: 0.90
Sensitivity: Standard
Paper Replication (Academic)
Kelly Fraction: 1.0
Max Leverage: 3.0x
Lambda: 0.94
Sensitivity: Standard
Adaptive: ON
Smoothing: 1
Remember: LEVERAGE MAGNIFIES BOTH GAINS AND LOSSES
Let me know if you have questions!
By 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/
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.