OPEN-SOURCE SCRIPT

EVaR Indicator and Position Sizing

146
The Problem:
Financial markets consistently show "fat-tailed" distributions where extreme events occur with higher frequency than predicted by normal distributions (Gaussian or even log-normal). These fat tails manifest in sudden price crashes, volatility spikes, and black swan events that traditional risk measures like volatility can underestimate. Standard deviation and conventional VaR calculations assume normally distributed returns, leaving traders vulnerable to severe drawdowns during market stress.

Cryptocurrencies and volatile instruments display particularly pronounced fat-tailed behavior, with extreme moves occurring 5-10 times more frequently than normal distribution models would predict. This reality demands a more sophisticated approach to risk measurement and position sizing.

The Solution: Entropic Value at Risk (EVAR)
EVaR addresses these limitations by incorporating principles from statistical mechanics and information theory through Tsallis entropy. This advanced approach captures the non-linear dependencies and power-law distributions characteristic of real financial markets.
Entropy is more adaptive than standard deviations and volatility measures.

I was inspired to create this indicator after reading the paper "The End of Mean-Variance? Tsallis Entropy Revolutionises Portfolio Optimisation in Cryptocurrencies" by by Sana Gaied Chortane and Kamel Naoui.

Key advantages of EVAR over traditional risk measures:
  • Superior tail risk capture: More accurately quantifies the probability of extreme market moves
  • Adaptability to market regimes: Self-calibrates to changing volatility environments
  • Non-parametric flexibility: Makes less assumptions about the underlying return distribution
  • Forward-looking risk assessment: Better anticipates potential market changes (just look at the charts :)


Mathematically, EVAR is defined as:
EVAR_α(X) = inf_{z>0} {z * log(1/α * M_X(1/z))}
Where the moment-generating function is calculated using q-exponentials rather than conventional exponentials, allowing precise modeling of fat-tailed behavior.

Technical Implementation
This indicator implements EVAR through a q-exponential approach from Tsallis statistics:
  • Returns Calculation: Price returns are calculated over the lookback period
  • Moment Generating Function: Approximated using q-exponentials to account for fat tails
  • EVAR Computation: Derived from the MGF and confidence parameter
  • Normalization: Scaled to [0-1] for intuitive visualization
  • Position Sizing: Inversely modulated based on normalized EVAR

The q-parameter controls tail sensitivity—higher values (1.5-2.0) increase the weighting of extreme events in the calculation, making the model more conservative during potentially turbulent conditions.

Indicator Components
1. EVAR Risk Visualization
  • Dynamic EVAR Plot: Color-coded from red to green normalized risk measurement (0-1)
  • Risk Thresholds: Reference lines at 0.3, 0.5, and 0.7 delineating risk zones


2. Position Sizing Matrix
  • Risk Assessment: Current risk level and raw EVAR value
  • Position Recommendations: Percentage allocation, dollar value, and quantity
  • Stop Parameters: Mathematically derived stop price with percentage distance
  • Drawdown Projection: Maximum theoretical loss if stop is triggered


Interpretation and Application
The normalized EVAR reading provides a probabilistic risk assessment:
  • < 0.3: Low risk environment with minimal tail concerns
  • 0.3-0.5: Moderate risk with standard tail behavior
  • 0.5-0.7: Elevated risk with increased probability of significant moves
  • > 0.7: High risk environment with substantial tail risk present

Position sizing is automatically calculated using an inverse relationship to EVAR, contracting during high-risk periods and expanding during low-risk conditions. This is a counter-cyclical approach that ensures consistent risk exposure across varying market regimes, especially when the market is hyped or overheated.

Parameter Optimization
For optimal risk assessment across market conditions:
  • Lookback Period: Determines the historical window for risk calculation
  • Q Parameter: Controls tail sensitivity (higher values increase conservatism)
  • Confidence Level: Sets the statistical threshold for risk assessment

For cryptocurrencies and highly volatile instruments, a q-parameter between 1.5-2.0 typically provides the most accurate risk assessment because it helps capturing the fat-tailed behavior characteristic of these markets. You can also increase the q-parameter for more conservative approaches.

Practical Applications
  • Adaptive Risk Management: Quantify and respond to changing tail risk conditions
  • Volatility-Normalized Positioning: Maintain consistent exposure across market regimes
  • Black Swan Detection: Early identification of potential extreme market conditions
  • Portfolio Construction: Apply consistent risk-based sizing across diverse instruments


This indicator is my own approach to entropy-based risk measures as an alterative to volatility and standard deviations and it helps with fat-tailed markets.

Enjoy!

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。