Modified Chartmill Value Indicator (MCVI)

I read about this indicator in an article titled “The Chartmill Value Indicator,” which appeared in the January 2013 issue of Technical Analysis of Stocks and Commodities. The article was written by Dirk Vandycke. In the article, Vandycke introduced an interesting oscillator called the Chartmill Value Indicator (CVI). The following article explains the CVI formulas, proposes a modified version of the CVI (MCVI), and demonstrates the potential of the MCVI with a sample pullback strategy. AMIBroker code for the MCVI is included at the end of the article.

The Modified Chartmill Value Indicator (MCVI)

The CVI represents a standardized deviation from a moving average, which can be applied to any price series over any period. The concept is simple. As prices rise, they will eventually rise above a moving average. Eventually, the moving average will begin to rise as well. At this point, prices need to continue to rise to increase the spread between the current price and the underlying moving average. When prices begin to level off or consolidate, the spread will begin to decline as the moving average continues to rise.

This behavior makes it very difficult for the deviation from a moving average to remain in the overbought or oversold regions for extended periods, which represents a significant improvement over other oscillators such as the RSI and Stochastic indicators.

However, a simple price spread from a moving average would not be comparable across all securities, which would preclude us from using the spread in systematic strategies. Fortunately, Vandycke addresses this problem by dividing the spread by the average true range, which is dependent on both the price level and volatility of the underlying security. Here are Vandycke’s formulas from the article (with slight changes in notation):

  • n = user specified number of periods
  • Value Consensus (VC) = MA((H+L)/2, n)
  • True High (TH) = Max(H, Ref(C,-1))
  • True Low (TL) = Min(L, Ref(C,-1))
  • True Range (TR) = TH – TL
  • Average True Range (ATR) = MA(TR, n)
  • CVI = (C – VC) / ATR

I like this type of indicator and have used similar versions in my algorithmic strategies and in my discretionary trading. However, I feel that the CVI formulas require one important change. Values for the original version of the CVI are not directly comparable across different time periods (n). In other words, it is much easier to achieve large positive or negative values for CVI (large deviations from the moving average), when the number of periods (n) is large.

From option pricing theory, we know that the magnitude of price changes is a function of time, but the relationship is not linear. Instead, price changes are proportional to the square root of time. If we assume that ATR (in the denominator of the CVI formula) is a proxy for volatility, then we can normalize the influence of time on CVI by multiplying ATR by the square root of the number of periods (n ^ 0.5). This adjustment is not perfect, because the moving average moves through time as well, but it is better than not adjusting volatility for time at all. Below is the revised formula for the modified Chartmill Value Indicator:

Modified Chartmill Value Indicator (MCVI) = (C – VC) / (ATR * (n ^ 0.5))

A Sample MCVI Reversal Strategy

When I evaluate a new indicator, I typically use AMIBroker to build a simple test strategy to better understand how the indicator works and how it could be used to add value. Since the MCVI is an oscillator, I created a weekly reversal strategy to buy when conditions were oversold and sell when the market was overbought.

These types of reversal strategies can be profitable, but the key is to only take trades in the same direction as the long-term trend. For the sample strategy below, I used a simple moving average filter, only taking long trades when the closing price was above the long-term moving average and only taking short trades when the closing price was below the moving average.

I optimized the strategy based on weekly values of the S&P 500 Index, the Russell 2000 index, and the NASDAQ 100 index from January 2000 to January 2013. Only one trade was permitted at a time and each trade represented 100% of portfolio equity. No stops were used. The purpose of this exercise was a proof-of-concept only. As a result, I did not withhold an out-of-sample data set. While the example below was based on weekly periods, the MCVI could be used for daily periods as well.

Optimized Parameters:

  • User Specified Look-back period (n): 3 weeks
  • Long Entry: Weekly CVI crosses below -0.51
  • Short Entry: Weekly CVI crosses above +0.43
  • Moving Average Filter Periods: 46 weeks
  • Long Exit: After 7 weeks
  • Short Exit: After 3 weeks

The top panel in Figure 1 below is a weekly candlestick chart of the NASDAQ 100 index (NDX) from late 2009 to January 2013. The blue line signifies the 46 week moving average that was used to filter long and short trades. The middle chart pane uses a histogram to depict the weekly MCVI readings. The bullish and bearish signal thresholds from the optimized strategy are represented by the dark green and dark red horizontal lines, respectively.

The bright green arrows represent prospective signals that met all of the strategy criteria. Note: not all of these trades would have been executed. Remember, only one position was permitted at a time and the strategy was tested on three different indices. In addition, trades remained open for multiple weeks. Nevertheless, the prospective signals should help you understand the types of trades executed by the MCVI reversal strategy.

It is interesting to note that the latest weekly CVI reading (on 1/11/13) for the NDX was above the bearish threshold. However, no strategy signal was warranted due to the moving average filter. Nevertheless, the NDX was overbought.

Figure1: NASDAQ 100 Index – Modified CVI Chart

Figure1: NASDAQ 100 Index – Modified CVI Chart

The third panel illustrates an enhanced SWAMI chart for the MCVI. I have written about SWAMI charts a number of times on this site. Briefly, enhanced SWAMI charts use color gradients to depict indicator values for a wide range of indicator periods on the same chart.

The blue line represents the average CVI value across the entire range of periods. The purple line is a moving average of the blue average SWAMI MCVI line. While I did not use the MCVI enhanced SWAMI indicator in the sample strategy, notice how effectively the extreme enhanced SWAMI levels identified prospective market turning points.

MCVI Strategy Results

The optimized MCVI strategy earned a compound annual return of 12.28%, but was only invested 34.41% of the time. The resulting risk-adjusted annual return was 35.69%. The maximum peak to trough drawdown was 17.80%, which resulted in a respectable CAR/Maximum Drawdown ratio of 0.69.

71.74% of the trades were profitable and the average profit on winning trades was 5.93% versus an average loss of -2.81% on the losing trades. The corresponding profit factor was 4.69; total gains were 4.69 times total losses. The Sharpe ratio was 1.64. The comprehensive strategy statistics are provided in Figure 2 below.

Figure 2: MCVI Reversal Strategy Results

Figure 2: MCVI Reversal Strategy Results

The equity curve is provided in Figures 3 below.

Figure 3: MCVI Strategy – Equity Curve

Figure 3: MCVI Strategy – Equity Curve

The equity drawdown curve is provided in Figure 4 below. The maximum drawdown was 17.8%, but drawdowns have remained below 10% since 2002.

Figure 4: MCVI Strategy – Equity Drawdown

Figure 4: MCVI Strategy – Equity Drawdown

MCVI AMIBroker Code

As promised, below is the AMIBroker code for the MCVI. It is a screenshot from my AMIBroker platform, so you would need to retype the code into your AMIBroker platform if you would like to experiment with the MCVI. The MCVI compiles and runs without error on my platform, so if you encounter any errors, they are probably the result of typos.

Note, the code below is for the MCVI, not for the MCVI strategy – although the sample parameters in the code below are the optimized parameters for the strategy.

Figure 5: MCVI AmiBroker Code

Figure 5: MCVI AmiBroker Code

As always, the sample code and strategy are presented for educational purposes only and are not intended as investment advice. In fact, I do not consider the MCVI sample strategy above to be viable in its current form – due to the lack of stops, which precludes any means of position sizing or risk management.

After initially publishing this article, several readers requested a copy of the actual MCVI strategy code (in addition to the indicator code above). If you read the comments below the article, you will see that I initially attempted to copy and paste the strategy code in my reply, but WordPress corrupted the AMIBroker code. As a result, I am including an image of the actual AMIBroker strategy code in Figure 6 below. The code in the image below is the actual AMIBroker code that generated the results in Figures 2, 3, and 4 above.

Figure 6: MCVI AmiBroker Strategy Sample Code

Figure 6: MCVI AmiBroker Strategy Sample Code

Conclusion

The MCVI and enhanced SWAMI MCVI show promise for use in systematic and discretionary strategies. While optimized, the strategy results were impressive, especially for only using a single indicator and a simple moving average filter in the strategy. Ideally, strategies should use several different types of indicators for trade confirmation.

The formula modification to create the MCVI (versus the CVI) is important, without which it would not be practical to generate a SWAMI version of the indicator.

— Brian Johnson, Trader Edge

If you liked Brian’s article check out his book, Option Strategy Risk/Return Ratios.

About the Author Brian Johnson

I have been an investment professional for almost 30 years. I worked as a fixed income portfolio manager, personally managing over $13 billion in assets for institutional clients. I was also the President of a financial consulting and software development firm, developing artificial intelligence based forecasting and risk management systems for institutional investment managers.

I am now a full-time proprietary trader in options, futures, stocks, and ETFs using primarily algorithmic trading strategies. In addition to my professional investment experience, I designed and taught courses in financial derivatives for both MBA and undergraduate business programs on a part-time basis for a number of years.

I am also the author of Option Strategy Risk / Return Ratios: A Revolutionary New Approach to Optimizing, Adjusting, and Trading Any Option Income Strategy.