Drawdown of Historical Stock Prices
Introduction
The drawdown of a stock indicates how much time it's spent "underwater" - it's essentially the percentage drop of its price from a peak to a trough, with the drawdown resetting to zero if a previous high is reached. The drawdown of a stock is a valuable risk measure and is employed by traders to gauge volatility.
This application
downloads historical stock prices from Yahoo Finance for a chosen ticker symbol,
defines a procedure that calculates the drawdown of the historical stock price
and plots the drawdown against the adjusted close price of the asset
By changing the ticker and the dates, you can examine drawdown of any stock between your chosen dates.
Ticker, Dates and Frequency
Download historical data for the S&P 500
Download Historical Stock Quotes
Strip out header row
Note that the adjusted close price is the seventh column.
Reverse the matrix so it's in date ascending order.
Calculate and Plot Drawdown
The algorithm is referenced from http://en.wikipedia.org/wiki/Drawdown_(economics)
DD is a vector that will be filled with the drawdown of the historical stock price
The maximum drawdown is