OPEN-SOURCE SCRIPT
Vol-Target Trend Engine

WHAT IT DOES
VTTE is a leveraged-ETF allocation engine. It holds a 3x index ETF (built for TQQQ/UPRO) only during favorable regimes, and lets realized volatility set the position size. There is no entry signal being predicted anywhere in the script - the edge is the risk-allocation policy itself, which is why the system has almost no tunable surface to overfit.
HOW IT WORKS
1) REGIME GATE - the position exists only while price trades above its 200-day SMA. Leveraged ETFs suffer volatility decay fastest in downtrends; the gate removes the catastrophic left tail instead of trying to predict it. Below the SMA the system is 100% cash.
2) VOLATILITY TARGETING - exposure = min(100%, target vol / realized vol), using 20-day realized volatility annualized against a 45% target. This is the same architecture vol-control indices and risk-parity desks run: position size shrinks mechanically as volatility expands, which front-runs drawdowns because volatility clusters.
3) REBALANCING - weekly, inside a 10% tolerance band to keep turnover and commission drag low, with an immediate de-risk override when held exposure runs 1.5x over target. Regime flips act immediately.
BACKTEST PROPERTIES (fully disclosed)
0.05% commission per side, 1 tick slippage, fills on close, $10,000 initial. TQQQ daily Feb 2010 - Aug 2026: +3,862% realized net, profit factor 3.33, 155 rebalance events (67.7% profitable), max drawdown 41.9%. Buy-and-hold TQQQ returned more over the same window (+20,107%) but with multiple drawdowns beyond 80%; the S&P 500 returned roughly +630%. The honest comparison is CAGR ~26% at roughly half of buy-and-hold's worst drawdown.
WHAT WAS TESTED AND REJECTED
A faster variant (5-day vol estimate, de-risk any day of the week) was tested and REJECTED with numbers: turnover more than doubled, the system repeatedly sold volatility spikes at their lows and re-bought higher, net return fell from +3,862% to +2,158%, profit factor 3.33 to 1.98, and max drawdown got WORSE (41.9% to 49.6%). Slow rebalancing is a feature, not a limitation.
INPUTS
Realized vol lookback (20d), target annualized vol (45%), regime SMA length (200), rebalance band (10%), fast de-risk toggle.
LIMITATIONS
Single instrument, single history, in-sample. TQQQ's listed history begins in 2010 - a mostly secular-bull window; the regime gate carries the 2020 and 2022 stress periods, but the configuration has not been walk-forward validated yet. Treat every figure as an upper bound on expectancy, not a forecast. Not financial advice.
VTTE is a leveraged-ETF allocation engine. It holds a 3x index ETF (built for TQQQ/UPRO) only during favorable regimes, and lets realized volatility set the position size. There is no entry signal being predicted anywhere in the script - the edge is the risk-allocation policy itself, which is why the system has almost no tunable surface to overfit.
HOW IT WORKS
1) REGIME GATE - the position exists only while price trades above its 200-day SMA. Leveraged ETFs suffer volatility decay fastest in downtrends; the gate removes the catastrophic left tail instead of trying to predict it. Below the SMA the system is 100% cash.
2) VOLATILITY TARGETING - exposure = min(100%, target vol / realized vol), using 20-day realized volatility annualized against a 45% target. This is the same architecture vol-control indices and risk-parity desks run: position size shrinks mechanically as volatility expands, which front-runs drawdowns because volatility clusters.
3) REBALANCING - weekly, inside a 10% tolerance band to keep turnover and commission drag low, with an immediate de-risk override when held exposure runs 1.5x over target. Regime flips act immediately.
BACKTEST PROPERTIES (fully disclosed)
0.05% commission per side, 1 tick slippage, fills on close, $10,000 initial. TQQQ daily Feb 2010 - Aug 2026: +3,862% realized net, profit factor 3.33, 155 rebalance events (67.7% profitable), max drawdown 41.9%. Buy-and-hold TQQQ returned more over the same window (+20,107%) but with multiple drawdowns beyond 80%; the S&P 500 returned roughly +630%. The honest comparison is CAGR ~26% at roughly half of buy-and-hold's worst drawdown.
WHAT WAS TESTED AND REJECTED
A faster variant (5-day vol estimate, de-risk any day of the week) was tested and REJECTED with numbers: turnover more than doubled, the system repeatedly sold volatility spikes at their lows and re-bought higher, net return fell from +3,862% to +2,158%, profit factor 3.33 to 1.98, and max drawdown got WORSE (41.9% to 49.6%). Slow rebalancing is a feature, not a limitation.
INPUTS
Realized vol lookback (20d), target annualized vol (45%), regime SMA length (200), rebalance band (10%), fast de-risk toggle.
LIMITATIONS
Single instrument, single history, in-sample. TQQQ's listed history begins in 2010 - a mostly secular-bull window; the regime gate carries the 2020 and 2022 stress periods, but the configuration has not been walk-forward validated yet. Treat every figure as an upper bound on expectancy, not a forecast. Not financial advice.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.