Saturday, July 28, 2012

Summary Book 1 - Chapter 4 Evaluating Trading Strategy Performance


Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:

Poppers theory focuses on the growth of human knowledge and the methods used in making new discoveries.

never accept that a strategy is going to be profitable.

assume the strategy is profitable until a better strategy is found or a there is a problem with it in historical data and performance.

a trading theory may change and not hold accross time. no strategy will continue to be profitable forever.

Flaws in current performance measures of a trading strategy:

Net Profit- widely quoted performance statistics. it is the dollar profit earned or lost during the life of the back-test.

maximize return per unit of risk.
Note:Absolute returns are not important as they do not measure the risk involved such as volatility of the stock,standard deviation of the price.


Profit factor- calculated by dividing the total profit gained on winning trades by the total loss on losing trades.
profitable strategy factor will be greater than one. unprofitable strategy will be less than one.

Gross Profit +1750
Gross Loss -1500
1750/1500 = profit factor of 1.17

profit to drawdown- ratio of net profit to maximum drawdown.
a drawdown occurs when net profit falls from its highest point.
calculated each trading day with the maxium value being the maximum drawdown.

deviding net profit by maximum drawback is a measure of reward to risk.
Riskier strategies have larger maximum drawdowns.

the problem with this is: this method net profit does not increase linearly with time.
 profit to drawdown ration varies depending on the length of time in the test.

One of my requirements for performance measures is the ability to compare various strategies regardless of the time frame studied.

Percent of profitable trades- used to gauge strategy success. the number of winning trades divided by the total number of trades in the back-test.

BETTER PERFORMANCE MEASURE
KRatio and sharpe ration, measures compare reward to risk in order to assess strategy performance.

Sharp Ratio:
if return is widely dispersed with large and winner and loser,its a risky trade because of the high standard deviation.
if returns are wrapped around the mean, the strategy has a smaller standard deviation and is less risky.

Sharpe ratio = Average return / Standard deviation of returns * Scaling factor

the scaling factor is the square root of time periods in a year.

when testing a strategy calculate the sharpe ratio and focus on finding strategies that produce sharpe ratios greater than positive one.

the sharpe ratio is its flaws. so to compliment it we use the K-ratio.
instead of looing at returns irrespective of when they occur, the Kratio calculates performance based on the stability of the equity curve.

first we need to create an equity curve to calculate K-ratio (graph of cumulative profits over time)

equity curve should increase linearly with respect to time.

if risk is constant thoughtout the life of the test, no adjustments need to be made to the equity curve.

start by calculating a linear regression (best fit line that minimizes the square error between forecast and actual) of the equity curve.

b1 in the equity curve is the proxy for reward in the k-ratio.

equity cruve i = b0 + b1 . trend i

risk in k-ratio is measured by calculating the standard error of the b1 regression coefficient.

large standard error indicates slope of the equity curve is inconsistent over time. small errors indicate consistent equity curve.
calculating K-Ratio in Excel


The K-ratio is calculated by dividing the b1 estimate by both the standard error of b1 and the number of periods in the performance test. By dividing by the number of data points, we normalize the K-ratio to be consistent regardless of the periodicity used to calculate its components.

K-ratio is a unitless measure of performance, Weekly performance of corn futures can be compared with tick data performance of trading IBM.


The Sharpe and K-Ratio are measures of trading strategy performance.

COMPARISON OF BENCHMARK STRATEGIES
the following 2 are benchmark strategies.

Channel breakout-trend following method
     Enter long if today’s close is the highest close of the past 40 days.
     Exit long if today’s close is the lowest close of the past 20 days.
     Enter short if today’s close is the lowest close of the past 40 days.
     Exit short if today’s close is the highest close of the past 20 days.
moving average crossover-trend following method
     Enter long if the 10-day simple moving average of closes crosses above the 40-day simple moving
average of closes.
     Enter short if the 10-day simple moving average of closes crosses below the 40-day simple moving
average of closes.

we calculate the K-Ratio and sharpe ratio of the channel breakout and moving average crossover over a portfolio of markets.

always trade with the trend.trend following is profitable as shown by history.

a strategy may decline through the days, meaning the average of returns may reduce every year for a
certain strategy.

Equity Curve and Regression Band Forecast. We can forecast equity growth using past data. If equity
falls below the lower band, we must reevaluate the potential of the strategy.

any strategy that performs badly can always be reversed to generate profit. simply by doing the opposite. sell when the signal is a buy, buy when the signal is a sell.

Some trading strategies may produce profits due solely to an overall rising or falling underlying market.

sometimes a strategy may work because of the markets uptrend. in order to remove the bias of the markets up direction we use the following formula:

return strategy = b0 + b1 return market + b2 returnmarket^2 + epsilon

if the t-statistics is less than +1 then chances are its performing due to markets runup or decline.
if t-statistics is greater than one, then strategy is valid and not biased

Magical thinking: people think that their behaviour causes something to happen while its another power that is making it happen. just because a strategy worked a few times in history doesnt mean it will work again.

Wednesday, July 25, 2012

Summary Book 1 - Chapter 3 Creating Trading Strategies

Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:

 3 building blocks for a trading system
1. Enteries - signals of buy and sell
2. Exits - indicate expected value of a trade has diminished to the point that the trade should be closed.
3. Filters - persuade the trader to only take entries with highest expected profits over the life of the system

Trend-following technique - buy signal while the market is in a period of strength.
sell signals are during period of weakness.

Moving average-the mean of a time series updated each trading day.
Most common moving averages are:Simple,Weighted, Exponential.

The simple moving average is an average of values recalculated every day.
Sum the previous days closing value and devide by the number of days.

Exponential moving average is calculated using todays price and yesterdays moving average value.alpha is the smoothing factor which is 2 devided by the number of days plus 1.

Sample Computation on EXCEL

A weighted moving average assigns higher weights to more recent data.

Trading signals are triggered when the price of a stock goes above the moving average, higher prices are likely and it signals that its time to buy.

When prices cross below the moving average, a declining market is expected and its time to sell.

a moving average of 20 to 100 days are commonly used to generate buy and sell signals. shorter moving averages will respond quicker to recent price movement.

longer moving averages produce trading signals infrequently.

when combining moving average methods such as exponential and simple, 10 and 40 days are used to generate signals.

if a market is prone to short and violent moves with many reversals along the way, moving average systems are likely to suffer. this drawback is called a whipsaw, asociated with choppy market action.

Channel breakout;
channels created when plotting a running tally of the highest highs and lowest lows over a fixed interval of days.

in a 40 day channel breakout: buy if market close was the highest of the past 40 days.
sell when the market close lower than any other close of the past 40 days.

A surge above the upper channel line shows extraordinary strength that can signal the start of an uptrend. Conversely, a plunge below the lower channel line shows serious weakness that can signal the start of a downtrend

Momentum-
take the difference between one value and another value at some point in time.
Momentum = Value Today - Value X days ago

Buy when todays close is greater than the close x days ago
Sell when todays close is less than the close x days ago

Volatility breakouts-
large short-term price jumps tend to be precursors of further movement in the same direction.
it is comprised of 3 pieces:
1. reference value - measurement price of the move from the start
2. volatility measure - computes the typical valatility of the market to separate significant movement from random price changes
3. volatility multiplier - determines the sensitivity of price movement required to trigger entry signals.

buy when prices close above the upper trigger.
sell when prices close below the lower trigger.

the most logical valatility measure is to calculate a standard deviation of price returns.


another volatility measure is to calculate the average true range.
1. the largest value of todays high minus todays low
2. largest value of todays high minus yesterdays close
3. largest value of yesterdays close minus todays low

 Excel Sheet showing how to calculate the 14 day Average True Range


average the true range over a set number of days to calculate ATR (average true range)

another volatility measure is the standard deviation of market prices.
this method does not allow strict interpretation using the normal distribution.

Volatility breakout entry points are derived by multiplying the volatility multiplier
by the volatility measure and adding that value to the reference value.

Volatility Breakout Rules
-Upper trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Buy when today’s close is greater than the upper trigger.
-Lower trigger = Reference Value (yesterday’s close, today’s open, short-term moving average) plus the Volatility Multiplier times Volatility Measure (standard deviation of price returns, average true range, standard deviation of
price). Sell when today’s close is less than the lower trigger

When a trend has become overextended or exhausted we define the technique as an Oscillator.

Sell signals are given using range statistics to explain that prices have risen too high and buy signals when prices are too low.

the premise behind standard oscillators is that once prices move to levels far from average, a reversal is eminent.

one method is the Relative strength index(RSI is the most popular). a market top is completed when the indicator rises above 70, while bottoms when fall below 30.

RSI sums the price changes of up days and compares them with the price changes of down days to calculate the RSI value.

RSI = 100 - ( 100 / (  1+  (U/D)  )  )
U is the average of all up moves
D is the average of all down moves

NOTE: The Relative Strength Index (RSI) rises and falls between 0 and 100

a stochastic oscillator compares current prices to the high and low range over a look-back period.

Traditional settings use 80 as the overbought threshold and 20 as the oversold threshold
stochastic oscillator

Fast %K stochastic is a smoothed out raw %K using a 3 day moving average
The fast %D stochastic is the smoothed out of the fast %K stochastic using another 3 day moving average.


the Raw %K stochastics = (Todays Close - Lowest low) / (Highest High - lowest low)

The moving average Convergence/Divergence (MACD) is an oscillator created by taking the difference between two exponential

averages.
1. a 12 day exponential weighted average with alpha=0.15
2. a 26 day exponential moving average with alpha=0.075

MACD = 12 Day EMA of close - 26  day EMA of close
MACD signal = 9 Day EMA of MACD

a popular patter of prices
SELL - Key reversal sell
todays high > yesterdays high
todays close < yesterdays close

BUY-key reversal buy
Todays Low < yesterdays low
Todays close > yesterdays close

signals that close profitable trades are called EXITS
signals that close unprofitable trades are called "STOPS"
Profit Targets close profitable

trades using range statistics.if we buy IBM at 100$ and the average true range of the past 20 days above the entry price of 100$ is 2$ then we sell at
100$ + (3)(2$) = 106$ we sell at 106$

A trailing exit has many examples to lock in profit before trade turns.
exit when market makes a 5 day low.
exit when market closes below previous pivot point

a pivot point is created when one days low is lower than both the

previous and following days low. (V Shape)
2 days before and 2 days after. or
3 days before and 3 days after.

LOSING IS A PART OF ALL TRADING (page 94 fail-safe exits)

FAIL SAFE EXIT
the trade goes against you by an amount equal to 2 times the average true range of the past 20 days.

if we buy IBM at 100$ and the average true range is 1.5$ we sell if 100 - (2*1.5$) = 97$ to minimize losses.

filters are used to either give a green light to trade or a red light that overrides buy and sell signal.

Trend filters:
Average directional movement index (ADX)
Vertical Horizontal Filter (VHF)

A typical use of a filter is to only take signals when values of these filters are greater than some threshold.

OUTSIDE BOOK SCOPE:
ADX is used to determine the direction and strength of a trend.

1. Calculate the True Range (TR), Plus Directional Movement (+DM) and Minus Directional Movement (-DM) for each period.

2. Smooth these periodic values using the Wilder's smoothing techniques. These are explained in detail in the next section.

3. Divide the 14-day smoothed Plus Directional Movement (+DM) by the 14-day smoothed True Range to find the 14-day Plus Directional Indicator (+DI14). Multiply by 100 to move the decimal point two places. This +DI14 is the Plus Directional Indicator (green line) that is plotted along with ADX.

4. Divide the 14-day smoothed Minus Directional Movement (-DM) by the 14-day smoothed True Range to find the 14-day Minus Directional Indicator (-DI14). Multiply by 100 to move the decimal point two places. This -DI14 is the Minus Directional Indicator (red line) that is plotted along with ADX.

5. The Directional Movement Index (DX) equals the absolute value of +DI14 less - DI14 divided by the sum of +DI14 and - DI14.

6. After all these steps, it is time to calculate the Average Directional Index (ADX). The first ADX value is simply a 14-day average of DX. Subsequent ADX values are smoothed by multiplying the previous 14-day ADX value by 13, adding the most recent DX value and dividing this total by 14.



strong trend is present when ADX is above 25 and no trend is present when below 20.

  • Theory: Large moves are a result of new information entering the markets.This information may not be immediately digested by all market participants.
  • Trading rule: Buy when today’s price change is greater than two standard deviations of the 20-day standard deviation of price changes.
  1. Formulate a theory
  2. Create an experiment
  3. draw conclusion

"I learned that following a detailed trading plan based
on sound historical results is the only way to trade effectively. And oh yeah, make
sure you’re awake and sober when placing your trades."

Summary Book 2 - Chart Patterns (Chapter 2)

For Up Trendlines
3 points on a trendline is valid.
draw the trendline along two minor lows in a forming price to see where the 3rd point may be.
a trendline starting with two close touches may not hold up in the longer term.
two points spaced too far apart may not have much value.
On average, trendlines with touches spaced widely apart perform better than those spaced close together.
on average long trendlines perform better than short ones
increasing the volume of stock as the trend continues is a good sign.
a breakout occurs when prices close below the trendline.
a high volume downward breakout propels prices further.

a plunge is a price trend that shows little price overlap from day to day leading to, but not including the breakout day.

INCOMPLETE

Tuesday, July 24, 2012

Summary Book 2 - Chart Patterns (Chapter 1)


A straight line drawn on a log scale is curved in arithmatic scale.
a straight line on a arithmatic scale is cureved on a log scale.
Many serious investors use the log scale or the semi log scale.
semilog means one acix uses the log scale, the other uses arithmatic.
A minor high is a small price peak where prices decline on either side of the peak for days or weeks.

A minor low is minor high upside down. Prices decline reach bottom low and climb.

A typical pattern is drawn from the highest high on the chart to the point of interest, making sure the line skirts but does not pierce, as many minor high as possible.

An internal trendline connects the price clusters, these are the flat tops of the consolidation regions, not the highest price in the minor highs.

why use an internal trendline? they represent the trading behavior of the masses. most price action takes place at the congestion area, not at the top of the tail.
When the minor high does not lineup draw an internal trendline.

NOTE there is no right or wrong spacing or touch count.


the longer the trendline, the more significant it is.
trendline angles are significant for performance.
volume trend influences the price performance after breakout
linear regression is a way to best fit a line to the volume points, the slope of the line gives you the trend.
market capitalization is the number of shares outstanding multiplied by the breakout price.
best performance comes from small caps then mid caps and finally large caps, not a mix.

Find the highest high and the lowest minor high before the lowest low. draw a down trendline between the two such that is does not intersect prices
the trend chanage method has 3 rules.
1. price must close above the trendline(point 1)
2. prices must stop making lower lows and retest the low (point 2)
3. price should climb above the prior minor high (point 3)
I tried this with

1 UTOPIA BERHAD [S] (0140) on the following url: http://www.bursamalaysia.com/market/listed-companies/list-of-companies/plc-profile.html?stock_code=0140

When Scoring :
a total above zero in a score means the trendline is likey to show good performance(better than the median rise) 56% performance - a buy signal;
score below zero suggests weak performance (below the median rise) 27% performance -avoid signal;
a zero score means it is your call whether you want to take a change and make an investment.

Saturday, July 21, 2012

Summary Book 1 - Chapter 1 Introduction

Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
  Summary:

In most circumstances, trading a portfolio of markets produces better reward-to-risk characteristics than trading any single market on its own.

We examine the benefits of trading a diversified portfolio of markets, strategies, and parameters in our trading accounts.

Intrigued by the possibility of new trading theories, quantitative traders research ideas every day that have never been explored before.

Today may very well be the day a trader discovers a new strategy that puts his or her trading over the top.

One question that's long been argued is whether discretionary traders are on the whole better than their quantitative trading counterparts.

Any CTA whose trading is at least 75 percent discretionary or judgment-oriented is categorized as a discretionary trader

by Barclays, while any CTA whose trading is at least 95 percent systematic is classified as systematic.

From these two categories, Barclays maintains the Barclays Systematic Traders Index and the Barclays Discretionary Traders Index.

Figure 1.1 details the performance of the systematic traders in relation to discretionary traders from 1996 through 2001..

Using quantitative analysis as a way to spot trading opportunities has become popular.

System trading is one example of quantitative analysis.

It involves traders automating buy and sell decisions by building mathematical formulae to model market movement.

Even successful traders tend to take profits too early in the trade, giving up a larger profit down the line.

The beauty of a mechanical trading system is that no trades are executed unless the trading system deems it necessary.

Let's ask first: What are trading systems? A trading system is a set of fixed rules that provide buy and sell signals.

You might ask: With numerous books written about trading systems and methods available and more coming out each month, why read this particular book? I'd answer that Quantitative Trading Strategies is unique because I bring quantitative analysis into the mainstream by presenting concepts in a realistic and logical manner.

While most books promote a specific trading method, they often fail to produce historical track records of their ideas or a background of other trading methods.

Trading with quantitative strategies involves much risk-risk that we hope to limit by using state of the art techniques to design, test, and trade our trading methods.

Readers will notice that I continually refer to the process of using fixed rules to trade markets based on previous price history as quantitative trading, rather than the popular term, "Technical analysis," typically used in the industry.

If we followed the fixedrule- trading strategy of buying when a market rose above its 200-day moving average and selling

when the market fell below its 200-day moving average, would we beat a buy-and-hold strategy? How much incremental return did an investor make by following the 200-day moving average rule over the past 5 or 10 years? The crossing of the 200-day moving average is a market prophecy that has existed for years.

Second, unlike Statement 3, when we suggest using a trading strategy that generates buy and sell signals, we'll test that strategy over many differing markets, each comprising multiple years of data.

Pioneers:
William D. Gann In the early 1900s, Gann made his name as a young stock and commodity broker.

A legendary trader, Gann put his ideas and his credibility on the line in an interview with the Ticker and Investment Digest magazine in 1909.

The magazine published a four page interview in which Gann recounted his trading record.

During October 1909, according to the interview, Gann made 286 trades in various stocks, 264 of which were profitable and only 22 resulting in losses.

Although Gann subsequently wrote a number of books, none truly describe his methods.

Gann's How to Trade in Commodities is one of my all-time favorite classics.

Richard Donchian Born in 1905, Robert Donchian established the first futures fund in 1949.

The fund struggled for the first 20 years, as Donchian traded commodity markets with a discretionary technical trading strategy.

Having started in the trading business during the deflationary 1930s, his outlook was continually biased toward the bearish side.

Despite never writing books on the subject of trading, Donchian utilized techniques that are extremely popular and the basis of many of today's strategies.

I included these two strategies to contrast more recent systems in my Comparison of Popular Trading Systems.

Welles Wilder New Concepts in Technical Trading by Welles Wilder, published in 1978, was one of the first books that attempted to take discretion out of the trader's hands and replace trading decisions with mathematical trading methodologies.

Wilder introduced the Relative Strength Index, an oscillator that is standard in nearly every software package today, the Parabolic Stop and Reverse system, and seven other methods.

His strictly quantitative methods make him a pioneer in the field of quantitative trading.

Thomas DeMark After writing a trading advisory service in the early 1980s, Thomas DeMark went to work for Tudor Investment Corporation, one of the most prestigious Commodity Trading Advisers in the world.

Paul Tudor Jones was so impressed with DeMark that the two opened a subsidiary, Tudor Systems Corporation, for the sole purpose of developing and trading DeMark's ideas.

Keeping the bulk of his trading techniques to himself throughout his trading career, DeMark, who has been called the "Ultimate indicator and systems guy", decided to give the rest of the world a glimpse of his methods when he published The New Science of Technical Trading in 1994.

If any readers have not read these two books, I strongly suggest you do so.

Testing and evaluating the ideas in these two books alone might take years for any one person.

Among DeMark's contributions are his Sequential indicator, DeMarker and REI, as well as numerous other systematic trading strategies.

The proliferation of modern quantitative trading began with a handful of futures traders in the 1970s.

Armed with IBM mainframes and punch cards, these traders began to test simplistic strategies on historical market data.

CTAs such as John Henry and Jerry Parker of Chesapeake Capital manage over a billion dollars each using trading systems to place bets on markets spanning the globe.

Jack Schwager, author of the critically praised books Market Wizards and New Market Wizards, has managed institutions' funds using trading systems applied to commodity markets.

These extraodinarily high costs hindered quantitative traders from entering the equity markets.

Although lower transaction costs after the elimination of the fixed commission structure pushed stocks closer to the realm of quantitative traders, it was the creation of the DOT in 1976 that truly opened the equity markets.

Some managers trade only futures, while others trade a multitude of investment products, including foreign and domestic stocks, convertible bonds, warrants, foreign exchange, and fixed income instruments.

A legend in the quantitative trading arena, Trout began conducting research for a noted futures trader at the age of 17.

In 1986 he moved upstairs and started a Commodity Trading Adviser in an effort to concentrate on position trading.

Until he retired in 2002, his Trout Trading Management Company produced some of the highest riskadjusted returns in the industry.

Over the years, Trout and his staff have tested and implemented thousands of models for actual trading.

According to New Market Wizards by Jack Schwager, Trout's trading is approximately half systematic and half discretionary, with an emphasis on minimizing transaction costs.

Add keywords here to make this summary more specific to a topic.
Strict Scan [?]
Popularly recognized as the man who bought the Boston Red Sox in 2002, in the trading arena John Henry is known as the founder of John W. Henry & Company in 1982.

An owner of farmland, Henry began trading agricultural markets in the 1970s as a means to hedge the prices of his crops.

During a summer trip to Norway in 1980, his trading methodology was shaped while reading the works of W. D. Gann and other trend followers.

Shortly afterward, he developed a quantitatively based system to trade futures, the bulk of which remains largely unchanged today.

After wildly successful periods in the late 1980s and early 1990s, JWH underwent an overhaul of their trading methodology.

John Henry summarizes his trading philosophy in four points: long-term trend identification, disciplined investment process, risk management, and global diversification.

Equity markets were becoming volatile, and Griffin was managing over $250,000 of Florida domiciled partnerships.

Prior to the Crash of 1987, Griffin, whose trading focused on quantitative methods, was short the market.

As the stock slid, Griffin was surprised when the options sold at a price less than their apparent value.

He spent hours at the Harvard Business School Library, researching the popular Black-Scholes option pricing model, and stumbled on what would become his bread and butter: trading and arbitraging convertible bonds.

The fund, still open today, initially traded convertible bonds and warrants from the United States and Japan.

Over the past decade, Citadel Investment Group has entered virtually every business associated with finance, including

risk arbitrage, distressed high yield bonds, government bond arbitrage, statistical arbitrage of equities, and private placements.

If I mentioned the name Renaissance Technology Corporation on Wall Street, the typical reply might be, "No thanks. I got creamed in technology stocks." Renaissance Technology, run by prize-winning mathematician Jim Simons, has everything to do with technology but nothing to do with losses.

If you have not heard of Simons or his firm, you are not alone.

After receiving his undergraduate degree from the Massachusetts Institute of Technology and a Ph.D. from the University of California at Berkeley, Jim Simons taught mathematics at MIT and Harvard.

Successfully investing in companies run by his friends, Simons left academia and created Renaissance Capital in 1978.
urrounding himself with over 50 Ph.D.'s, and resembling an academic think tank more than a cutting edge trading firm,

Simons's operation manages over $4 billion.

They are less likely to accept an apparent winning strategy that might be a mere statistical fluke.

Though quantitative traders are certainly curious about how they will make money applying quantitative analysis to the markets, the more encompassing question is why they can make money in the markets.

Why should there be any profits to trading? Most traders have studied the efficient markets hypothesis, or EMH, which

states that current prices reflect not only information contained in past prices, but also all information available publicly.

In such efficient markets, some investors and traders will outperform and some will underperform, but all resulting

performance will be due to luck rather than skill.

The roots of the efficient markets hypothesis date back to the year 1900, when French doctoral student Louis Bachelier

suggested that the market's movements follow Brownian motion.

The efficient markets hypothesis remained popular during the 1960s and 1970s, as a number of simplistic studies added

credence to the theory that no effort of quantitative trading could succeed over the long run.

These results suggested that the market is not efficient and that active investors could indeed outperform the market.

Once we systematically identify the appearance of these patterns, we can explore the profitability of trading signals that

these patterns generate.

Curtis Arnold's PPS Trading System was one of the first works to systematically define trading patterns and test trading rule validity when these patterns occurred.

Whereas interpreting charts was very much an art, Arnold defined each pattern and systematically tested trading rules to buy and sell based on when these patterns occurred.

Thomas Bulowski has taken this research even further with his books Encyclopedia of Chart Patterns and Trading Classic Chart Patterns.

The occurrence of each of the 10 patterns on actual stock data should roughly match the occurrence of patterns on the

randomly generated data.

In addition to the increased frequency of some patterns, returns following certain patterns' presence were also

significant-specifically, declines following the head and shoulders top, and rallies that followed the head and shoulders bottom.

Even if a handful of investors and traders act irrationally by buying and selling based on irrelevant information, the market should still be priced efficiently.

Market efficiency runs into trouble when the actions of irrational investors do not cancel out.

Consider the situation where irrational investors all pile on and buy the market at the same time or they all run for the exits at the same time.

If all the irrational investors buy or sell together, they can overwhelm the rational investors and cause market inefficiencies.

Now the 20 irrational investors, all momentum players, begin to buy the stock due to its performance, driving the stock up to $135. They buy from rational people who are willing to sell their stock above their perceived fair value.

When irrational investors move together, market irrationality can exist and take hold for quite some time, eventually leading to bubbles, panics, and crashes.

He found a significant tendency for investors to sell winning stocks too early and hold losing stocks too long.

Over his test period, investors sold approximately 50 percent more of paper profits on winning trades than they sold of paper losses in losing trades.

Based on the data, Odean concluded that winning stocks were sold quicker and more frequently than losing stocks.

Winning stocks that were sold continued to rise, while losing stocks that were held continued to fall in value.

In the year following sales, stocks sold with gains by individual investors outperformed the market by an average 2.35 percent.

Clearly, the more profitable course of action suggested by the study is to buy winning stocks and sell losing ones.As a result, investors and traders take winners very quickly and hold on to losers.

To demonstrate, give people the following choice: Game 1 75 percent chance of making $1000 25 percent chance of making $0

or 100 percent chance of making $750 We can calculate the expected value of each game by summing the product of each outcome's probability by its payout: Expected payout of risky choice = 75% $1000 25% $0 = $750 While the expected

value of both options is the same in Game 1, individuals tend to be very risk averse with gains.

Most people will take the certain $750 rather than take the risk for a higher payout.

Now consider Game 2, which presents the exact same choice, only among losses: Game 2 75 percent chance of losing $1000 25 percent chance of losing $0 or 100 percent chance of losing $750 Expected payout of risky choice = 75% -$1000 25% $0

= -$750 In Game 2, most people will choose to risk the chance to come out even and take the first option.

Basically, the tendencies revealed in both games show that individuals are risk averse with their winnings and risk seeking with their losses.

From practical experience, I can add that I've often caught myself holding on to losing trades while thinking, "If I can only get out even on this trade," or taking it so far as to calculate breakeven points in hopes of avoiding the disappointment of closing out a losing trade.

The second theory explaining why investors sell winners and hold losers is that investors buy and sell stocks as if they expect mean reversion in prices.

Conversely, when rates are high, they are met by demand from investors looking to lock in the abnormally high interest rates.

If investors believe that stock prices move in a similar path, they will be willing to sell stocks that rally and hold stocks that decline-believing that each will eventually return to its more normal level.

Consider stock XYZ, as seen in Figure 1.14.
A similar example is stock ABC in Figure 1.15.

When ABC breaks above $50 per share after also trading between $45 and $50, we might believe that the stock should be sold on the basis that it too will reenter its previously established $45 to $50 range again.

When prices rise above recent ranges, prospect theory dictates that traders with long positions will exit trades while traders losing money on short positions will hold their trades.

As the market rises above the old trading range, mean reversion thinking will suggest that the market has overextended

itself on the rally and will eventually return to its previous trading range.

Those who fight the trend will lose, while traders who trade with the breakout will feast on the natural human tendencies of those market participants unable to take trading losses.

Smart traders ignore the human bias of both prospect theory and mean reversion and establish positions in the direction of the breakout, while other traders with losing positions hold on.

The pain of these losing trades is eventually realized, and losses are very often closed near a market extreme.

As we will see, using quantitative trading strategies will mitigate these human tendencies and generate trading strategies

based on optimal historical performance-not psychological tendencies.

These zero coupon bonds, unlike a traditional bond that pays a coupon semiannually, are debt obligations that pay no coupons.

Smart bond traders were often able to sell the coupon strips at a price higher than the original bond, profiting the

difference in buy and sell values without any risk.

Futures Contracts In the mid 1980s, Salomon Brothers' Bond Arbitrage Group bought government bonds in the cash market while shorting the 30-year bond future.

The 30-year Treasury bond future, traded on the Chicago Board of Trade, calls for delivery of U.S. Treasury bonds that are not callable for at least 15 years.

The daily mismatch between bond prices and the conversion factors leads to one bond becoming cheaper to deliver than any other bonds.

In the early 1980s, bond futures would sometimes trade expensive compared to the underlying .

Even more recently, sophisticated stock option traders could buy options on individual stocks and sell stock index options to create a profitable risk-free payoff based on the diffusion of individual stock returns.

Sophisticated options traders often trade the difference in volatility between individual stock options and index options.

Fair pricing between the stock and index options is based on the correlation of stocks to other stocks in the index.

The constant theme throughout these stories is that traders with the best quantitative analysis are able to capitalize on market inefficiencies when they appear.

If markets were perfectly efficient, traders would stop research and no longer continue to look for profitable trading strategies or undervalued companies.

With the reappearance of these inefficiencies, traders would slowly begin to exploit them again, bringing the market back to efficiency.

If there are profits in quantitative trading, should we bother studying fundamental analysis as well? I believe there is money to be made on the fundamental side.

As hedge funds have become more popular and their numbers and assets have grown, better independent fundamental analysis is being performed on companies' balance sheets and earnings streams.

While there's no substitute for solid fundamental analysis, I believe that using quantitative trading strategies can detect factors that affect stock prices more quickly than waiting for earnings announcements and company conference calls.

While there are good fundamental analysts performing very rigorous work, when analyzing companies' earnings potential, even the best analysts are subject to the market's underreaction and overreaction.

The problem with fundamental analysis is that the underlying fundamentals of companies change very slowly, making it difficult to capitalize on volatile price swings in the equity market, which are typically caused by investor sentiment and perception.

There are very talented and bright fundamental analysts, but to take advantage of the short-term swings in the markets-

whether it be stocks, futures, or other markets-we will focus on the quantitative side and use past market prices to generate trading signals.

Summary Book 1 - Chapter 2 An Introduction to Statistics

Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:
Summary:
Descriptive statistics are tools that allow traders to better understand and comprehend
data in an easy and effective manner.
Instead of presenting the height measurements of 100 men, I could instead offer that
the average height of these 100 men is 5 feet 8 inches.

By providing one descriptive statistic, I have characterized a quality of the entire
sample of height measurements.

I can take this process further by revealing that the standard deviation of heights is 3 inches.

By calculating descriptive statistics on market prices, market returns, and market

volume, we can learn much about the nature of recent price movement.

These descriptive statistics will become the building blocks for our quantitative
trading systems.

The mean of a series, more commonly referred to as the average, is a measure of
central location. The mean is the sum of the values in a distribution divided by the
number of data points in the distribution.

We may wish to measure how widely values spreadacross a distribution. Do the values clump closely around a central point or are they distributed widely? The most popular methods used to measure the dispersion
of values are variance and standard deviation.

Variance, often represented by 2, measures how wide the spread of values
span from the mean.

if a company has a larger variance than another company it means the returns of that
company vary more widely and are more volatile.

Correlation is another important descriptive statistic. It measures the strength of a
relationship between two series.

The correlation statistic is calculated by multiplying the difference
of one series from its mean by the corresponding difference of another series
from its mean, taking the average product, and then dividing by the product of the
standard deviation of both series.

In Figure 2.5, y increases as x does. This indicates a positive correlation
between x and y. In Figure 2.6, a different relationship exists. As x increases, y
decreases, indicating negative correlation.

it is important to perform your analysis using returns rather than prices.

Standard deviation is a popular method of measuring dispersion, primarily due
to its properties under certain circumstances, specifically those associated with
a normal distribution.


normal distribution, For example, we know that roughly 68.26 percent of
the values in a normal distribution fall between ±1 standard deviation of the mean,
95.44 percent fall between ±2 standard deviations, and 99.74 percent between ±3
standard deviations

explain how volatility varies over time. These models are called GARCH, for Generalized Auto
Regressive Conditional Heteroskedasticity. A GARCH process exists when
volatility itself changes over time, wandering back and forth around a long-term
average.

We start by calculating the standard deviation of the first 20 returns. On the
next day, we drop the first return from our calculation, add the 21st return, and
recalculate the standard deviation of returns. The following day we drop the second
return and add the 22d return in our calculation of standard deviation. And so
on. Each value of the 20-day standard deviation will have 19 common return
points as the value before and value after. In this sense, the calculation “rolls” with
each day, hence the expression “rolling volatility.”

volatility scales with the square root of time, we multiply our daily standard deviation by the square root of trading days in a year (typically 252 for equity markets). The result of this adjustment is an annualized standard deviation, or volatility.

This property of volatility is common to almost all markets. Periods of
high volatility are often followed by further periods of high volatility, slowly
decreasing to more normal levels over time. Similarly, periods of low volatility are
often followed by further periods of low volatility, eventually returning to normal
levels over time.GARCH cannot or does not predict
market returns or prices, volatility has important implications
for generating trading signals as well as managing the risk of portfolios

If we know a market’s annualized volatility, we can calculate the daily risk of
being long or short.

The daily standard deviation of being long or short the S&P
500 is equal to the value of the portfolio multiplied by the annualized standard
deviation divided by the square root of 252 (trading days in year)

lognormal distribution. This is somewhat similar to the normal
distribution in its shape, except the left- and right-hand side of the distribution
is not symmetrical.The lognormal distribution
of prices is used commonly and is the basis for the Black-Scholes option pricing
formula.

Wednesday, July 18, 2012

Summary Book 1 - Prologue

Quantitative trading strategies harnessing the power of quantitative techniques to create a winning trading program:

SUMMARY

Quantitative trading strategies are a combination of technical and statistical analysis which, when applied, generate buy and sell signals.

Once these trading strategies are formed, their performance is tested historically to validate the trading ideas.

After the performance is tested, we select the markets to be traded.

By trading a widely diversified portfolio, we are able to minimize our risk while maintaining expected reward.

Developing the idea, testing historical performance, and picking markets to trade are a few of the many techniques required for efficient and profitable trading strategies.

While a few books have touched on various areas of the development process, I believe this book is the first to fully capture all the nuances of the trading process.

Studying these fundamental factors is the most common method of analyzing markets.

Technical analysis does not attempt to predict market movements based on fundamentals.

As a result, technical analysts believe that price action is the best source of information.

Catchy names such as "Head and shoulders top," "Symmetrical triangle," and "Trendline" are a large part of the technical analyst's toolbox.

Typically, the technical analyst relies on a good bit of discretion for his or her trading ideas.

While a pattern may look like a buy signal to one technical analyst, another may see a different pattern emerging and actually be preparing to sell the market.

Whenever we make statements about the market, we can perform mathematical and statistical tests to determine if we are correct in our beliefs.

Do changes in interest rates affect returns on the stock market? If corn prices have been rising, is it likely that they will continue to do so in the near future? Considering that historical data for market prices is available back to the turn of the twentieth century in many cases, we can study historical market prices and usually find answers to these questions once we quantify each of these questions.

The remainder of this book will attempt to answer questions aimed at understanding exactly how markets behave and how investors and traders can profit from this information.

Most of our study involves creating, testing, and applying trading strategies.

A trading strategy is a set of rules that signal the trader when to buy, when to sell, and when to sell short a market.

The signals can also be very complex and include statistical regression and relationships between many related markets.
The most vital part of trading system development is performance testing.

When we test historical performance, we first want to see if our strategies have been profitable in the past.

Because many strategies will be profitable historically, we need a methodology to compare the profitability among trading strategies.

Very often the most profitable system is not the best system for our trading.

I believe most traders use outdated and inconsistent performance measures to evaluate historical performance.

Finally, we need to develop a money management plan for trading our strategies.

Once we have designed and tested our trading strategy, the next choice is to decide which markets to trade.

Shares of companies trade on three major markets in the United States: the New York Stock Exchange , the American Stock Exchange, and the NASDAQ.

While the NYSE and AMEX are physical trading floors where buyers and sellers meet to trade shares, the NASDAQ is a linkage of market makers negotiating prices with customers and with each other.

Due to the high leverage and low transaction costs associated with the futures market, these markets have long been a popular trading vehicle for quantitative traders.

Most of these markets are actually combinations of other markets where one asset is bought and the other asset is sold short.

Once we design and test our quantitative trading strategies, we can implement them on these new markets to gain access to products outside the typical stock and futures markets.

Three forms of the EMH (Efficient Markets Hypothesis) exist: strong form EMH, semi-strong form EMH, and weak form EMH.

The strong form of EMH suggests that all information, both public and private, is always incorporated into current prices.

The semi-strong form of the EMH states that current prices reflect all information in the public domain, including annual company reports, USDA crop estimates, Wall Street research reports, and quality of corporate management.

The weak form EMH suggests that prices already reflect all information that can be derived from analyzing historical market data, such as closing prices, volume, and short interest.

All three forms of the EMH suggest that our attempts to make money by buying and selling based on prior price patterns are hopeless.

These cracks in the EMH hint that markets may not be as efficient as was once thought.