Type/to search

Volatility Filtered Market Timing Strategy

Common strategy
Created: 2024-01-15 12:27:47
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy implements an enhanced buy and hold strategy by adding a filter based on historical volatility. The filter closes long positions during high volatility market regimes and re-enters long positions when volatility is low, in order to reduce maximum drawdown.

Strategy Logic

  1. Calculate the historical volatility of SPY over the past 100 days
  2. If current volatility is higher than the 95th percentile of past 100 day's volatility, filter out that trading day, close long position
  3. If volatility is below 95th percentile, enter long position

Advantage Analysis

Compared to simple buy and hold without filter, this strategy improved annualized returns over the 28 year backtest period (7.95% vs 9.92%) and significantly reduced max drawdown (50.79% vs 31.57%). This shows adding a volatility filter can improve returns and lower risk to some extent.

Risk Analysis

Main risks come from accuracy of volatility calculation methodology and filter parameter tuning. If volatility calc is inaccurate, filter will fail. If filter parameters are tuned poorly (too conservative or aggressive), it can adversely impact strategy returns. Also, past performance does not guarantee future results.

Optimization Directions

Consider adding other confirming indicators as additional filters, like long term moving average, ADX index etc. Parameter tuning is also critical, like testing different lookback periods, filtering thresholds etc. Machine learning & time series analysis techniques can also be used to build and optimize the volatility prediction model.

Summary

This strategy greatly improved returns and reduced max drawdown of a SPY buy & hold strategy via a simple volatility filter. It shows the importance of market regime identification and asset allocation. We can further refine it by optimizing the volatility model and adding confirming signals.

Source
Pine
/*backtest
start: 2023-01-08 00:00:00
end: 2024-01-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// 
// @author Sunil Halai
//
Strategy parameters
Strategy parameters
Upper percentile filter (Do not trade above this number)
Lookback period
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)