Variable Index Dynamic Average – Trading Strategy Backtest (Does it work?)
Last Updated on April 24, 2023
Variable Index Dynamic Average strategy backtest
Over the years, chartists have developed indicators to help them analyze the market better. While there are many of these indicators, a few stand out for their usefulness. One of such is the Variable Index Dynamic Average. Do you know what it is? Can we make profitable Variable Index Dynamic Average strategies in the markets?
Variable Index Dynamic Average backtest and best settings
Before we go on to explain what a Variable Index Dynamic Average is and how you can calculate it, we go straight to the essence of what this website is all about: quantified backtests.
Our hypothesis is simple:
Does a Variable Index Dynamic Average strategy work? Can you make money by using Variable Index Dynamic Average strategies?
We look at the most traded instrument in the world: the S&P 500. We test on SPDR S&P 500 Trust ETF which has the ticker code SPY.
All in all, we do four different backtests:
- Strategy 1: When the close of SPY crosses BELOW the N-day moving average, we buy SPY at the close. We sell when SPY’s closes ABOVE the same average. We use CAGR as the performance metric.
- Strategy 2: Opposite, when the close of SPY crosses ABOVE the N-day moving average, we buy SPY at the close. We sell when SPY’s closes BELOW the same average. We use CAGR as the performance metric.
- Strategy 3: When the close of SPY crosses BELOW the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
- Strategy 4: When the close of SPY crosses ABOVE the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
The results of the first two backtests look like this:
Strategy 1
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
8.85 |
6.44 |
4.92 |
3.35 |
2.01 |
2.16 |
MDD |
-32 |
-40.24 |
-50.7 |
-49.2 |
-56.58 |
-50.54 |
Strategy 2
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
0.88 |
3.17 |
4.67 |
6.26 |
7.65 |
7.49 |
MDD |
-57.97 |
-41.34 |
-48.04 |
-36.23 |
-26.61 |
-42.43 |
The results from the backtests are pretty revealing: in the short run, the stock market shows tendencies to mean-reversion. In the long run, it is better to use trend-following strategies.
Why do we reach that conclusion?
Because if we use a short moving average, the best strategy is to buy when stocks drop below the average and sell when it turns around and closes above the moving average (buy on weakness and sell on strength). This can clearly be seen in the first test above for the 5-day moving average. The 5-day moving average returns a CAGR of 8.85%, which is almost as good as buy and hold even though the time spent in the market is substantially lower.
When we buy on strength and sell on weakness, in the second test in the table above, the best strategy is to use many days in the average. The longer the average is, the better. The 200-day moving average returns 7.49%, which is pretty decent.
Worth noting is that the max drawdown is higher than for wahy you find for simple moving average and exponential moving average, for example.
The results from backtesting 3 and 4 look like this (the results are not CAGR, but average gains per trade):
Strategy 3
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.16 |
0.4 |
1.05 |
2.47 |
4.11 |
8.98 |
10 |
0.31 |
0.6 |
1.18 |
2.06 |
4.85 |
9.45 |
25 |
0.52 |
0.8 |
1.74 |
3.15 |
5.41 |
10.92 |
50 |
0.51 |
0.74 |
1.72 |
2.8 |
5.43 |
7.93 |
100 |
0.82 |
1.15 |
0.97 |
3.68 |
7.24 |
13.07 |
200 |
0.45 |
0.94 |
3.15 |
5.96 |
5.31 |
9.66 |
Strategy 4
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.12 |
0.11 |
0.67 |
1.79 |
3.87 |
9.02 |
10 |
0.1 |
0.19 |
0.72 |
1.84 |
3.74 |
8.61 |
25 |
0.16 |
0.32 |
1.1 |
1.63 |
5.1 |
9.14 |
50 |
0.35 |
0.14 |
0.84 |
1.74 |
5.01 |
6.73 |
100 |
0.07 |
0.04 |
0.6 |
1.92 |
4.77 |
9.46 |
200 |
-0.33 |
-0.1 |
1.27 |
3.74 |
5.02 |
7.05 |
As expected, the longer you are in the stock market, the better returns you get. This is because of the tailwind in the form of inflation and productivity gains. The averages in strategy 3 is among the best for all the moving averages we have tested (see full list below).
However, be aware that we have tested just four strategies of the moving average. There are basically unlimited ways you can use a moving average and your imagination is probably the most restricting factor!
What is a Variable Index Dynamic Average (VIDYA)?
The variable index dynamic average (VIDYA, for short) was developed by Tushar Chande as an overall improvement over the exponential moving average. It is an adaptive moving average, which means that it not only smooths the price but also adapts to market volatility. The indicator uses the standard deviation to adapt to the market volatility.
Chande introduced the indicator in 1992 in his book: Technical Analysis of Stocks & Commodities. Two years later, he modified the indicator by replacing standard deviation with the Chande Momentum Oscillator as its volatility index. Thus, the VIDYA belongs to the group of adaptive moving averages that are often referred to as Intelligent Moving Averages.
The sensitivity improves by assigning more weight to the ongoing data as it generates a better signal indicator for short and long-term markets. This is unlike the traditional moving averages which cannot compensate for sideways moving prices and often generate a lot of false signals, and when you try a longer period is used, the MA reacts slowly to reversals in trend when prices move up and down over a long period. However, with the VIDYA regulating its sensitivity and adapting to sideways price swings, it functions better in any market conditions.
How to Calculate a Variable Index Dynamic Average
The variable index dynamic average does not use a preset period to calculate its average; instead, it automatically adjusts its period based on market volatility.
The formula for calculating the VIDyA can be written as follows:
VIDyA = [P + (a*bv)P_{1} + (a*bv)^{2}P_{2} + … + (a*bv)^{(n-1)}P_{(n-1)}]/ [1 + (a*bv) + (a*bv)^{2} + … + (a*bv)^{(n-1)}]
Where:
P = current price
P1 = price 1 period ago
P2 = price 2 periods ago
a = smoothing constant 2/(n+1)
n = user-defined number of periods for the average
bv = 5 period std dev / 20 period std dev
The VIDyA formula can also be reduced to this:
VIDyA = 2 / (BP +1) * VI * (Close – Previous VIDYA) + Previous VIDYA
Where:
BP = the user bar period for the MA
VI = Volatility Index which is used dynamically to adapt the bar period to a trend.
While VI could be any indicator, Efficiency Ratio is the most used for this purpose
VI = ER = Change / Sum of absolute changes
Here, “Change” is calculated as the change selected by a user bar period (BP), while “sum of absolute changes” is calculated as the sum of absolute changes of each bar in the selected period.
Why use a Variable Index Dynamic Average?
Because of its responsiveness to price, the variable index dynamic average may be more useful than a typical moving average. For short-term trading, it could be a formidable tool when used appropriately.
A weekly chart of EURUSD with the variable index dynamic average.
The VIDYA can help traders to spot trend changes, filter out noise from the chart, and track prices more closely. Overall, traders would want to look for a rally above the indicator for a bullish signal or a dip below the line for a bearish signal. Additionally, it can also be very useful when paired with a slower moving average like the simple moving average; in which case the trader can employ a crossover strategy.
When a long period setting is used, the indicator may also serve as ascending support levels in an up-trending market or descending resistance levels in a down-trending market.
How to use a Variable Index Dynamic Average
This indicator can be found in popular trading platforms, such as Tradingview. Simply locate your indicator tab and search for it. If you are unable to find this in your trading platform, you can pay someone to code one for you.
When you attach one to your chart, adjust the settings to your preferred choice. A short-term period, such as 5,10, or 20, will be more useful if you’re a day trader or a swing trader. If you wish to focus on the long-term trend, use long-period settings, such as 100 or 200.
How can you use a Variable Index Dynamic Average
You can use the variable index dynamic average as a standalone indicator to identify trends and short-term price swings, but you can also pair it with a slower moving average for a crossover strategy.
When using it alongside a slower moving average like the simple moving average, you will just wait for crossover to time your entry or exit.
In the above chart, the VIDYA (blue line) crossing above the 50-period simple moving average (light-blue line) confirms a bullish signal. Notice how the price also moves above the VIDYA. A good exit strategy is when the VIDYA line falls below the 50-period simple moving average. The opposite is true for a sell signal as you can see in the chart below.
Drawbacks with a Variable Index Dynamic Average
Despite its adaptive attribute, the VIDYA is still plagued by the lag factor, as it is with all moving average indicators. The reason is that its calculation is based on past price data. Also, the indicator can give multiple false signals when the price is moving randomly without trending in any direction.
Relevant articles about moving averages strategies and backtests
Moving averages have been around in the trading markets for a long time. Most likely, moving average strategies were the start of the systematic and automated trading strategies developed in the 1970s, for example by Ed Seykota. We believe it’s safe to assume moving averages were a much better trading indicator before the 1990s due to the rise of the personal computer. The most low-hanging fruit has been “arbed away”.
That said, our backtests clearly show that you can develop profitable trading strategies based on moving averages but mainly based on short-term mean-reversion and longer trend-following. Furthermore, there exist many different moving averages and you can use a moving average differently/creatively, or you can combine moving averages with other parameters.
For your convenience, we have covered all moving averages with both detailed descriptions and backtests. This is our list:
- Moving average trading strategies
- Exponential moving average (backtest strategy)
- Hull moving average (backtest strategy)
- Linear-weighted moving average (backtest strategy)
- Adaptive moving average (backtest strategy)
- Smoothed moving average (backtest strategy)
- Variable moving average (backtest strategy)
- Weighted moving average (backtest strategy)
- Zero lag exponential moving average (backtest strategy)
- Volume weighted moving average (backtest strategy)
- Triple exponential moving average TEMA (backtest strategy)
- Triangular moving average (backtest strategy)
- Guppy multiple moving average (backtest strategy)
- McGinley Dynamic (backtest strategy)
- Geometric moving average GMA (backtest strategy)
- Fractal adaptive moving average FRAMA (backtest strategy)
- Fibonacci moving averages (backtest strategy)
- Double exponential moving average (backtest strategy)
- Moving average slope (backtest strategy)
We have also published relevant trading moving average strategies:
- The 200-day moving average strategy
- Trend-following system/strategy in gold (12-month moving average)
- Trend following strategies Treasuries
- Is Meb Faber’s momentum/trend-following strategy in gold, stocks, and bonds still working?
- Trend following strategies and systems explained (including strategies)
- Does trend following work? Why does it work?
- A simple trend-following system/strategy on the S&P 500 (By Meb Faber and Paul Tudor Jones)
- Conclusions about trend-following the S&P 500
- Why arithmetic and geometric averages differ in trading and investing
FAQ Variable index dynamic average (VIDA)
Let’s end the article with a few frequently asked questions about the variable index dynamic average:
What is a variable index dynamic average (VIDA) strategy?
A variable index dynamic average (VIDA) strategy is an investment strategy that seeks to outperform the market by tracking by using the moving average to find good entry and exit points.
Does it work?
That depends. The only way to find out is to backtest. Most traders make the cardinal mistake of not knowing if they have a positive statistical edge.
What are the benefits of a VIDA strategy?
A VIDA strategy provides investors with the opportunity to diversify their portfolio, automate trading, manage risk, and take advantage of market opportunities.
When you automate, you can let your computer make the buying and selling.
What is variable moving average?
The Variable Moving Average (VMA) is a study that uses an Exponential Moving Average being able to automatically adjust its smoothing factor according to the market volatility.
Is variable index dynamic average any good?
That depends. In this article, we backtested the moving average on stocks. The results might vary greatly depending on the asset you are backtesting on.
Variable index dynamic average – takeaways
Our takeaway from the backtests is that Variable index dynamic average strategies work well if you buy on weakness (a close below the moving average) and sell on strength (a close above the moving average) when you use a short number of days. Opposite, it’s best to buy on strength (a close above the moving average) when you use a longer moving average.