0% found this document useful (0 votes)
336 views5 pages

Technical Analysis of Stocks & Commodities - Using Implied Volatility and Volume With Code

Technical Analysis Of Stocks & Commodities - Using Implied Volatility And Volume With Code.pdf

Uploaded by

Ernesto Mora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
336 views5 pages

Technical Analysis of Stocks & Commodities - Using Implied Volatility and Volume With Code

Technical Analysis Of Stocks & Commodities - Using Implied Volatility And Volume With Code.pdf

Uploaded by

Ernesto Mora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Reprinted from Technical Analysis of STOCKS & COMMODITIES magazine. © 2003 Technical Analysis Inc., (800) 832-4642, http://www.traders.

com

BASIC TECHNIQUES

Forecasting Trends With Indexes

Using Implied Volatility


And Volume
Construct a trend-following system that adjusts to There are various ways to calculate volatility. The Black-
current market conditions. Scholes model is the most popular method. Since implied
volatility itself represents a one-year standard deviation of
price movement, traders can use this number to estimate the
extent of price changes over the next year. Specifically, the
raditionally, technicians have relied higher the implied volatility, the more the market can be

T on historical prices to analyze the mar- expected to move up and down over the next year.
The implied volatility of the Standard & Poor’s 100, calcu-
ket. They have created many different lated by the Chicago Board Options Exchange, is called the
indicators to predict the direction of volatility index (VIX). The VIX is often referred to as “the
prices by basing their calculations on investor fear gauge,” and is used extensively by contrarians. Its
past data. However, these indicators may fail to work value tends to rise as financial markets decline and investors
become increasingly fearful about the future. You can use this
prospectively when markets do not repeat their his- relationship between prices and implied volatility to help
torical patterns. Thus, using these indicators to fore- identify market tops and bottoms, since extreme levels in
cast market direction is like trying to drive a car by implied volatility tend to accompany extreme levels in prices.
looking in the rearview mirror. Any change in the In Figure 1 you can see that extremely high levels of the VIX
are associated with market bottoms, while extremely low
road ahead could lead to disaster. levels of the VIX are associated with market tops. For the trend-
When we are searching for ways to forecast the following system, I compared the current level of the VIX to the
direction of the market, it is essential to characterize VIX levels over the previous 252 trading days (there are 252
the market with current information. Two such ways trading days in a year). When the VIX is at extremely high levels,
the market should be making a bottom and the system should be
of describing the market are with implied volatility more inclined to take a long position. Conversely, when the VIX
and volume. Using implied volatility and volume as is at extremely low levels, the market should be making a top and
parameters, you should be able to construct a profit- the system should be more inclined to take a short position.
able trend-following system by adjusting the number
VOLUME
of days referenced in a simple Donchian-style In addition to implied volatility, volume is another important tool
breakout system. This allows the system to adjust for analyzing the markets with current information. Volume refers
itself to reflect current market conditions. to the number of shares or contracts bought and sold over a given
time. This value is a measure of buying and selling interest in the
marketplace. Price Headley, the author of Big Trends In Trading,
IMPLIED VOLATILITY uses Bollinger Bands to analyze volume levels in the financial
The implied volatility is volatility that the market is currently indexes. He notes that high levels of volume are associated with
anticipating for the underlying asset, which can be a futures market bottoms, as investors rush to protect their portfolios by
contract, a stock, or an exchange-traded fund (ETF)†. Implied
volatility is usually used for trading options on the underlying,
but you can also use it to trade the underlying itself. Calculating When we are searching for ways to
volatility can be a problem, because you are trying to measure forecast the market direction, it is
something that will occur in the future. Implied volatility is essential to characterize the market
based on an expectation as opposed to a posted value, but it is
a necessary component of any option pricing model. with current information. Two such
ways of describing the market are
with implied volatility and volume.
by Scott Castleman
Reprinted from Technical Analysis of STOCKS & COMMODITIES magazine. © 2003 Technical Analysis Inc., (800) 832-4642, http://www.traders.com

Market top
OEX
Market top

Market top
Market bottom FIGURE 1: THE S&P 100 INDEX (OEX)
VERSUS THE IMPLIED VOLATILITY
Market bottom INDEX OF THE S&P 100 OPTIONS
Market bottom
(VIX). The top price chart is the S&P
100 index (OEX), and the bottom price
VIX Up arrows indicate high VIX levels chart is the implied volatility index of the
S&P 100 options (VIX). The red up
arrows indicate high levels of the VIX,
while the blue down arrows indicate low
Down arrows indicate low VIX levels levels. The high VIX levels reached in
September 2001, July 2002, and
TRADESTATION

October 2002 are associated with


market bottoms. Low VIX levels reached
in July 2001, March 2002, and August
2002 are associated with market tops.

shorting the financial market indexes. Low levels of volume are METHODS AND RESULTS
associated with market tops, as investors become complacent over The logic of this system is based on the Donchian breakout
their recent gains and feel little need to protect their portfolios. system, which is a stop-and-reverse (SAR) trend-following
In my analysis of volume, I have chosen to smooth the data system based on recent high and low prices. The Donchian
using simple moving averages because of the large day-to-day system suggests going long if today’s high exceeds the highest
fluctuations. Figure 2 compares the short-term (10-day) simple price of the previous four weeks, and entering a short position
moving average (SMA) of volume to the long-term (50-day) SMA if today’s low exceeds the lowest price of the previous four
of volume for the S&P 500 index. From the chart, it is evident that weeks. By using the implied volatility and volume as inputs,
high levels of volume are associated with market bottoms, while you can incorporate current market conditions into this analy-
low levels of volume are associated with market tops. sis. Specifically, the number of days referenced by the system
For this trend-following system, I have chosen to compare varies along with the implied volatility and volume.
the 10-day SMA of volume to the highest and lowest volume As the implied volatility and volume reach extremely high
levels over the past 50 trading days. If the 10-day SMA of volume levels, the system becomes more and more likely to take a long
is at extremely high levels, then the market should be making a trade as the market makes a bottom. As the implied volatility and
bottom, and the system will be more inclined to take a long volume reach extremely low levels, the system becomes more
position. Conversely, if the 10-day SMA of volume is at ex- and more likely to take a short trade as the market makes a top.
tremely low levels, the market should be making a top, and the This relationship is illustrated in Figure 3.
system will be more inclined to take a short position. The longest period of days referenced by the system is 29,

S&P 500
Market top Market top

Market top
Market bottom
Market bottom Market bottom
FIGURE 2: 10-DAY VERSUS THE 50-
DAY SMA OF VOLUME. The lower part
Volume
of the chart compares the 10-day SMA
of volume to the 50-day SMA of volume.
The red up arrows indicate high levels
of volume, while the blue down arrows
indicate low levels. Note that high
volume levels in September 2001, July
Red line = 10-day simple moving average of volume
Blue line = 50-day simple moving average of volume 2002, and October 2002 are associated
Up arrows indicate high levels of volume with market bottoms. Low volume levels
Down arrows indicate low levels of volume in August 2001, late March and early
April 2002, and late August 2002 are
associated with market tops. These time
periods coincide with the extreme high
and low levels reached in the VIX.
Reprinted from Technical Analysis of STOCKS & COMMODITIES magazine. © 2003 Technical Analysis Inc., (800) 832-4642, http://www.traders.com

S&P 500

VIX
FIGURE 3: DAYS REFERENCED BY
THE SYSTEM FOR LONG AND SHORT
TRADES. On the bottom part of the
chart, the solid red line represents the
Volume Red line = 10-day simple moving average of volume
number of days referenced for long
trades, while the dashed blue line
represents the number of days Blue line = 50-day simple moving average of volume
referenced for short trades. Note that
the system reacts to the spikes in the Dashed blue line = days referenced for short position

VIX and in volume in the middle of


September 2001 by referencing fewer
days for long trades. This causes the
system to become increasingly likely to Solid red line = days referenced for long position
take a long trade. The S&P 500 index
proceeded to rally 21% off the lows
made on September 21, 2001.

and the shortest is four. According to author Howard TRADESTATION CODE


Simons’ analysis of recent highs and lows, a period of fewer
than three days does not provide enough information, and {Use any finanical index for data set 1
a period of more than 29 days provides too much. The and the appropriate volatility index for data set 2.}
EasyLanguage code for this system is provided in Figure 4.
Inputs: refLength1(29),refLength2(25),lookBackIV(252),
Figure 5 shows the performance summary from January lookBackVolume(50);
1996 to December 2002 for the trend-following system,
tested on the Russell 2000 futures contract. There were a Var: dayLengthLong(0), dayLengthShort(0),
total of 64 trades, which is enough to be statistically currentIV(0),lowestIV(0),highestIV(0),
significant. Two key numbers are the percentage of trades avgVolume(0),
that were profitable and the ratio between the average lowestVolume(0),highestVolume(0);
winning trade and the average losing trade. currentIV = close of data2;
With 46.88% of the trades being profitable and with an lowestIV = lowest(close of data2,lookBackIV);
highestIV = highest(close of data2,lookBackIV);
average win/loss ratio of 1.93, the system shows a signifi-
avgVolume = average(volume,10);
cant edge. In addition, both long and short trades contribute lowestVolume = lowest(volume,lookBackVolume);
almost evenly to the overall profitability of the system. The highestVolume = highest(volume,lookBackVolume);
most profitable trade accounts for about 25% of the total
profit, and the ratio between net profit and maximum If (highestIV - lowestIV) <> 0 and (highestVolume-lowestVolume)
drawdown is approximately 5 to 1. <> 0 then
Figure 6 shows the annual performance of the system from dayLengthLong = intportion(refLength1 -
the beginning of 1996 to the end of 2002. Each year was 0.5*refLength2*
((currentIV - lowestIV)/(highestIV - lowestIV) +
profitable, except for 2000, with 2001 being the most prof-
(avgVolume - lowestVolume)/
itable (as the system took advantage of the large downtrend (highestVolume-lowestVolume)));
in the financial markets).
If (highestIV - lowestIV) <> 0 and (highestVolume-lowestVolume)
<> 0 then
CONCLUSION dayLengthShort = intportion(refLength1 -
This trend-following system has yielded impressive results 0.5*refLength2*
on the Russell 2000 futures contract for the past six years. ((highestIV - currentIV)/(highestIV - lowestIV) +
Using the implied volatility and volume, this trend-follow- (highestVolume - avgVolume)/
ing system attempts to incorporate current information (highestVolume-lowestVolume)));
about the marketplace. Whereas high levels of implied If high>highest(high[1],dayLengthLong) then
volatility and volume appear to coincide with market tops, buy next bar on open;
low levels of implied volatility and volume appear to
coincide with market bottoms. This system adjusts to cur- If low<lowest(low[1],dayLengthShort) then
sell Short next bar on open;
rent market conditions by increasing or decreasing the
reference period used to take long and short positions based FIGURE 4: TRADESTATION CODE. Use any financial index for dataset 1 and the
on current levels of implied volatility and volume. This corresponding volatility index for dataset 2.
Reprinted from Technical Analysis of STOCKS & COMMODITIES magazine. © 2003 Technical Analysis Inc., (800) 832-4642, http://www.traders.com

TRADESTATION STRATEGY PERFORMANCE REPORT dynamic capability of the system increases the
likelihood that it will continue to work in the
TrendIV&Volume @RL-Daily (1/10/1996–12/31/2002) future as markets continually change.
Performance summary: All trades Because of today’s choppy market conditions,
Total net profit $199,750.00 Open position P/L ($600.00) it would be advisable to test the system with
Gross profit $403,225.00 Gross loss ($203,475.00) additional indicators to filter out some of the
Total # of trades 64 Percent profitable 46.88% whipsaws. Using indicators such as the average
Number winning trades 30 Number losing trades 34
directional movement index (ADX) or requiring
Largest winning trade $52,050.00 Largest losing trade ($18,800.00)
Average winning trade $13,440.83 Average losing trade ($5,984.56)
the price to move in the direction of the trade one
Ratio avg win/avg loss 2.25 Avg trade (win & loss) $3,121.09 average true range before entering the market
Max consec. winners 4 Max consec. losers 5 may eliminate some of the losing trades.
Avg # bars in winners 42 Avg # bars in losers 14
Max intraday drawdown ($38,375.00)
Scott D. Castleman is a professional trader from
Profit factor 1.98 Max # contracts held 1 Rochester Hills, MI. Previously, he was a trader
Account size required $38,375.00 Return on account 520.52% at the Chicago Mercantile Exchange, where he
worked for Option Insight Trading Group. He
Performance summary: Long trades currently trades financial index futures. He can
Total net profit $86,000.00 Open position P/L $0.00 be reached at [email protected].
Gross profit $187,475.00 Gross loss ($101,475.00)
Total # of trades 32 Percent profitable 53.13%
Number winning trades 17 Number losing trades 15 SUGGESTED READING
Largest winning trade $34,275.00 Largest losing trade ($18,800.00) Headley, Price [2002]. Big Trends In Trading:
Average winning trade $11,027.94 Average losing trade ($6,765.00) Strategies To Master Major Market Moves,
Ratio avg win/avg loss 1.63 Avg trade (win & loss) $2,687.50 John Wiley & Sons.
Max consec. winners 4 Max consec. losers 4 Murphy, John J. [1999]. Technical Analysis Of
Avg # bars in winners 36 Avg # bars in losers 14 The Financial Markets, New York Institute
Max intraday drawdown ($43,450.00)
of Finance.
Profit factor 1.85 Max # contracts held 1
Account size required $43,450.00 Return on account 197.93%
Natenberg, Sheldon [1994]. Option Volatility &
Pricing: Advanced Trading Strategies And
Performance summary: Short trades Techniques, revised ed., McGraw-Hill.
Total net profit $113,750.00 Open position P/L ($600.00) Simons, Howard J. [1999]. The Dynamic Op-
Gross profit $215,750.00 Gross loss ($102,000.00) tion Selection System: Analyzing Markets
Total # of trades 32 Percent profitable 40.63% And Managing Risk, John Wiley & Sons.
Number winning trades 13 Number losing trades 19
Whaley, Robert E. [1994]. “Derivatives On
Largest winning trade $52,050.00 Largest losing trade ($14,500.00)
Average winning trade $16,596.15 Average losing trade ($5,368.42)
Market Volatility: Hedging Tools Long Over-
Ratio avg win/avg loss 3.09 Avg trade (win & loss) $3,554.69 due,” Journal of Derivatives.
Max consec. winners 2 Max consec. losers 4 _____ [2003]. “The Investor Fear Gauge,” http://
Avg # bars in winners 51 Avg # bars in losers 14 faculty.fuqua.duke.edu/%7Ewhaley/pubs/
Max intraday drawdown ($55,825.00) fear_gauge.pdf, February 20.
Profit factor 2.12 Max # contracts held 1
Account size required $55,825.00 Return on account 203.76% See our Traders’ Tips section this month for strategies
implementing Scott Castleman’s concepts.
FIGURE 5: PERFORMANCE SUMMARY FROM JANUARY 1996 TO DECEMBER 2002 S&C

ANNUAL TRADING SUMMARY


Annual analysis (marked-to-market): Annual rolling period analysis (marked-to-market):
% Profit # % % Profit # %
Period Net profit gain factor trades profitable Period Net profit gain factor trades profitable
YTD $0.00 N/A N/A 0 N/A 02 $34,075.00 12.85% 1.28 10 90.00%
12 month $45,550.00 17.96% 3.39 10 40.00% 01-02 $125,075.00 71.85% 1.76 14 107.14%
02 $34,075.00 12.85% 1.28 10 90.00% 00-02 $121,975.00 68.84% 1.48 22 86.36%
01 $91,000.00 52.28% 3.14 5 120.00% 99-02 $139,650.00 87.55% 1.48 34 79.41%
00 ($3,100.00) (1.75%) 0.96 9 44.44% 98-02 $152,275.00 103.68% 1.39 47 74.47%
99 $17,675.00 11.08% 1.45 13 61.54% 97-02 $187,725.00 168.48% 1.47 54 74.07%
98 $12,625.00 8.60% 1.13 14 57.14% 96-02 $199,150.00 199.15% 1.45 65 72.31%
97 $35,450.00 31.82% 4.06 8 62.50%
96 $11,425.00 11.42% 1.26 12 58.33%

FIGURE 6: ANNUALIZED PERFORMANCE SUMMARY FROM JANUARY 1996 TO DECEMBER 2002


Reprinted from Technical Analysis of STOCKS & COMMODITIES magazine. © 2003 Technical Analysis Inc., (800) 832-4642, http://www.traders.com

TRADERS’ TIPS
Here is this month’s selection of Traders’ Tips, contributed by / ( HighestIV - LowestIV )
various developers of technical analysis software, all to help + ( AvgVolume - LowestVolume )
readers more easily implement some of the strategies presented / ( HighestVolume - LowestVolume ) ) );
in some of the articles in this issue. Internet users will also find If ( HighestIV - LowestIV ) <> 0
these and most previous Traders’ Tips at our website at and ( HighestVolume - LowestVolume ) <> 0
www.Traders.com. then
DayLengthShort = Intportion( RefLength1 - 0.5
* RefLength2 * ( (HighestIV - CurrentIV )
/ ( HighestIV - LowestIV )
+ ( HighestVolume - AvgVolume )
/ ( HighestVolume - LowestVolume ) ) ) ;

✦ TRADESTATION: IMPLIED VOLATILITY AND VOLUME Plot1(DayLengthShort,”DLS”);


Scott Castleman’s article in this issue, “Using Implied Plot2((HighestIV - CurrentIV )
/ ( HighestIV - LowestIV )*10,”VixRng”);
Volatility And Volume,” describes a market-adaptive channel Plot3(( HighestVolume - AvgVolume )
breakout system in which the channel lookback period is a / ( HighestVolume - LowestVolume )*10,”VolRng”);
function of implied volatility and volume. The core strategy’s
Indicator: IVV Thresholds:
EasyLanguage code can be found in the sidebar of the article inputs:
itself. RefLength1( 29 ),
We have elaborated on Castleman’s code by creating two RefLength2( 25 ),
LookBackIV( 252 ),
new indicators. The first displays the “LookBack” calculations LookBackVolume( 50 ) ;
producing his trading “thresholds.” The second plots the
thresholds themselves. We have named them “IVV Lookback” variables:
DayLengthLong( 0 ),
and IVV Thresholds.” DayLengthShort( 0 ),
The IVV Thresholds indicator is fairly straightforward, CurrentIV( 0 ),
looking something like a Bollinger Band or Keltner channel. LowestIV( 0 ),
The IVV LookBack is probably most useful as an aid for HighestIV( 0 ),
AvgVolume( 0 ),
understanding how the implied volatility and volume scheme LowestVolume( 0 ),
works. The thresholds are based on a lookback window of HighestVolume( 0 ),
variable length (displayed as a magenta line). The length is a NextTrade( 0 ) ;
function of the VIX range (cyan line) and data1 volume range CurrentIV = Close of Data2 ;
(yellow line). The higher the VIX and volume range, the LowestIV = Lowest( Close of Data2, LookBackIV ) ;
shorter the lookback for determining the breakout threshold. HighestIV = Highest( Close of Data2, LookBackIV ) ;
AvgVolume = Average( Volume, 10 ) ;
LowestVolume = Lowest( Volume, LookBackVolume ) ;
Indicator: IVV Lookback: HighestVolume = Highest( Volume, LookBackVolume ) ;
inputs:
RefLength1( 29 ), If ( HighestIV - LowestIV ) <> 0
RefLength2( 25 ), and ( HighestVolume - LowestVolume ) <> 0
LookBackIV( 252 ), then
LookBackVolume( 50 ) ; DayLengthLong = IntPortion( RefLength1 - 0.5
* RefLength2 *
variables: ( ( CurrentIV - LowestIV ) / ( HighestIV - LowestIV )
DayLengthLong( 0 ), + ( AvgVolume - LowestVolume )
DayLengthShort( 0 ), / ( HighestVolume - LowestVolume ) ) );
CurrentIV( 0 ),
LowestIV( 0 ), If ( HighestIV - LowestIV ) <> 0
HighestIV( 0 ), and ( HighestVolume - LowestVolume ) <> 0
AvgVolume( 0 ), then
LowestVolume( 0 ), DayLengthShort = IntPortion( RefLength1 - 0.5
HighestVolume( 0 ), * RefLength2 *
NextTrade( 0 ) ; ( ( HighestIV - CurrentIV ) / ( HighestIV - LowestIV )
+ ( HighestVolume - AvgVolume )
CurrentIV = Close of Data2 ; / ( HighestVolume - LowestVolume ) ) ) ;
LowestIV = Lowest( Close of Data2, LookBackIV ) ;
HighestIV = Highest( Close of Data2, LookBackIV ) ; Plot1( Highest( High[1], DayLengthLong ), “BuySig” );
AvgVolume = Average( Volume, 10 ) ; Plot2( Lowest( Low[1], DayLengthShort ), “ShortSig” );
LowestVolume = Lowest( Volume, LookBackVolume ) ;
HighestVolume = Highest( Volume, LookBackVolume ) ;
This strategy code will be available for download from the
{ Perform core ‘DayLengthLong’ calculation for a Buy setup } EasyLanguage Exchange at TradeStationWorld.com. Look
If ( HighestIV - LowestIV ) <> 0 for the file “Castleman IVV w_Stops.eld.”
and ( HighestVolume - LowestVolume ) <> 0
then —Ian MacAuslan and Mark Mills
DayLengthLong = Intportion( RefLength1 - 0.5 EasyLanguage Questions Forums
* RefLength2 * ( ( CurrentIV - LowestIV ) TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.

You might also like