web analytics
 

Archive for October, 2011

Intro To Technical Analysis Course (2/2)

Today, I want to share the conclusion of the plan I began in this post.  The Introduction to Technical Analysis Course (ITAC) will be presented here, in a freely available blog format consisting of both written material and video over the course of the next several months. I will try to be as responsive to questions and comments as possible, allowing for the possibility that those comments could spiral out of control. I may try to continue to drive through, presenting new material, rather than getting involved too deeply in discussion. The first two sections will cover Price Discovery and Price Behavior. The remaining four sections are:

3. Volatility

Volatility is one of the most misunderstood and abused concepts in market analysis. Too many commentators go straight to the VIX, which is a specific measure of a specific type of volatility, ignoring broader concepts and implications. This section will take a deep look at volatility: What is it? How do we measure it, and what are the limitations of those measurements? How can we trade it? (A brief excursion into some non-direction option spreads.) Most importantly, we will look at the implications that volatility has for directional traders; one of the key tasks of technical analysis is to quantify the most likely emerging volatility regime.

4. Market Math

Yes, it may seem to be hard to get excited about a section on market math, but there are critical lessons here. Many traders struggle because they do not understand basic rules of probability. What is the ideal risk:reward ratio for trades? What is the ideal win ratio? (Both of those questions are meaningless.) How can we create a positive expectancy in trading systems? These and more questions will be explored.

One of the cornerstones of my work, both in my actual trading research and in my writing, is that few traders understand randomness. One of the best ways to understand actual trading edges is by exploring the implications of trading in random markets, in which no edge is possible. We will take a look at many of the common ways in which traders can be deceived by randomness.

5. Relative Value

In many ways, simple, directional trades are the most difficult. There is much information in the relative performance of different markets, whether they be sectors, regions, commodities, or individual stocks. We will explore different ways to quantify and to track these relative performance measures, and will consider some basic techniques to trade them. Even if the trader does not wish to incorporate these trades per se into the trading plan, this analysis can provide another layer of information in your market analysis.

6. Psychology and Practical Trading

Though it is not possible to explore all the issues different traders will encounter, I want to share some of my perspectives on trader psychology. Be aware that these are very different from much of the prevailing wisdom; I’ve hit on some of them in previous blogs, but a brief preview is that I believe most traders who fail do so because they do not understand that the process of becoming a trader is about transformation. It has more in common with mythological stories than with skill development and competitiveness. Most traders struggle with fear and greed because they do not understand the true nature of risk, and are not able to think about their results over a large sample of trades. (This is in precisely the point Mark Douglas makes in his excellent Trading in the Zone.)
So, there’s the plan. This should be a long, strange trip, with some diversions and modifications as we go along, but I think this rough outline will survive intact. It will probably be easier to absorb the material step-by-step, as we go along, so please bookmark and return often. I’ll get started, at the beginning, in the next few days.

Intro to Technical Analysis Course: The Plan (1/2)

As I mentioned in a previous post, I have been planning to create a course that would serve as an introduction to the book. I have thought long and hard about this course: who is the target audience? What should it include? How should it be delivered? How should it be structured? How do I make it as universal as possible? Here is a rough outline of the material I will be expanding upon over the coming months:

The target audience for this course is, ideally, someone who is new to technical analysis. Obviously, this could be a beginning trader, but I hope it will also offer promise to experienced traders who wish to come to the markets with “beginner’s eyes” and see things from a new perspective. In addition, there are many people, whether they are analysts, portfolio managers, risk managers, or even some types of traders, who have a sophisticated understanding of some aspects of financial markets, but have not incorporated a technical discipline into their thought process. I hope that many of these people will find some value here as well.

I believe that beginners need a few things: ideas that they can immediately apply, minimal ambiguity, and as little emphasis on theory as possible. Unfortunately, it is going to be difficult to meet many of those needs in this course because we also need to look into many issues in considerable depth. As for the idea of immediately applying ideas or setups to the market, I believe that no such thing is possible. There is no price pattern, or indicator pattern, that can be learned and naively applied to the markets. Such an approach is doomed to failure, and that is not what we are pursuing here. My goal in creating this course is to build a deep understanding of the dynamics that shape prices, and to also explore some of the fundamental math behind trading and probabilities. Lastly, but equally importantly, we will take a quick look at some of the psychological challenges of trading, and see how mass psychology can drive markets.

This course will be divided into six parts, presented in order in the format of both written material and videos. I anticipate approximately 15 hours of video total, and, frankly, I do not know how much written material to support that. There will also likely be supporting charts and excel sheets. My plan is to post two installments each week for this course, always tagged with “ITAC” (Introduction to Technical Analysis Course), so you will be able to find them easily. I will also make an index page so all the material will be available and organized there. Here are the broad topics I plan to cover:

1. Price Discovery. There is a significant body of work on auction theory, and many readers will be familiar with Dalton’s Market Profile work. I want to begin at the beginning. Much of what happens in financial markets appears to be very complicated, but, at their core, the basic concepts are simple. The modern currency trader has much in common with merchants in Antiquity who brought their spices, fabrics or perfumes to a marketplace, met with buyers and agreed on value. I want to take a deep look at “the scales and the reckoning that weighs value against value”. We will first imagine the problems facing buyers and sellers, and will begin to understand how a bid/ask spread evolves. Next, we will try to understand how a market participant might attempt to profit in this very simple market. Traders who have not examined the price discovery process like this will learn some surprising things about market prices.

I was fortunate to be able to take some classes in market microstructure (if you are a college or graduate student, seek out this opportunity!) that really opened my eyes. I had been trading 10 years at the time, so I had a different perspective from many students. We operated simulated trading terminals, first in completely random, noisy markets. Gradually, other complications were introduced, such as the presence of a group of traders who had paid for information (and not always reliable information, by the way) about future prices. Seeing the patterns that evolved out of the interaction of these noise traders and informed traders opened my eyes. If you have this experience, you will never see something in the market and declare, as you will so often hear traders say, “that must be real.” So many convincing patterns emerge out of randomness and noise, which brings us to…

2. How Prices Move in Active Markets. Though this may seem like an ambitious section, I want to clearly define the scope. The first section will explain how the actions of buyers and sellers can drive very short-term price movements. This section will expand on that work, and will show how these movements can spin out over larger structures and timeframes. Though I am trying to make much of this course as universal as possible, this section will be the most personal and the most idiosyncratic, for one reason: I believe that virtually nothing in common practice technical analysis actually works.

Now, that may seem like an unusual claim for someone who just wrote a large book on the subject of technical analysis, but hear me out: I have been unable to find any quantifiable edge behind most of the tools traders use. Though some traders may use those tools and make money (in reality, there are probably far fewer profitable traders than most people believe), many profitable traders do not understand the reason for their success. It is not in their chart patterns, or their moving averages or indicators; it is in the way they have synthesized those into a whole trading system that is perfectly aligned with their personalities and risk tolerances. This is not only good, it is essential, for this is the only way to succeed in the markets, but this creates trading systems that cannot be transmitted or taught.

The patterns and ideas examined in this section will be high-level, conceptual patterns. Rather than focusing on pennants and heads and shoulders, we will consider things like what should follow a large price movement in one direction? When is a movement overextended, and more likely to reverse? What are the patterns that can show that buyers or sellers are losing control in a market? How can we judge the underlying psychology behind a move, and how sure can we be of the answer? Yes, much of this material is covered elsewhere, but I hope to offer a new perspective and to lay the foundation for a simple, robust and complete way to look at market action.

These are two of the three sections. Tomorrow, I’ll lay out the rest of the plan, covering:

3. Volatility

4. Expected Value and Random Walks

5. Relative Value Plays

6. Psychology

A Few Trading Rules

In doing the preparation and background work for the book, I found a set of rules for a swing trading system I traded for many years.  I thought I would share a few snippets from those rules, especially the parts dealing with trade management and behavior management.  I cleaned them up, and removed specific system references… and I think this list is now relevant for traders regardless of timeframe or instrument.  To me, it’s useful to re-read things like this sometimes, just to remind myself of the obvious, and, though these.  I hope you find them useful, but you should adapt them to the specifics of your own situation and personality.

Trade Management

  • Let winners run. While momentum is in phase, the market can run much further than might be expected.
  • Corollary to that rule: Do not exit winners without reason!
  • Be quick to admit when wrong and get flat.
  • Sometimes a time stop is the right solution. If a position is entered, but the anticipated scenario does not develop then get out.
  • Remember: if one thing isn’t happening the other thing probably is. Historically, this has never been good for me…
  • Be careful of correlations. Several positions can often equal one large position bearing unacceptable risk. Please think.

Other thoughts

  • I am responsible for risk management, money management, trade management, doing the analytical work and putting on every trade that comes.
  • I am not responsible for the outcome of any one trade. Markets are highly random. I do not have a crystal ball. I am not as smart as I think I am.
  • Risk management is the first and last responsibility. I can make almost any mistake and be ok as long as I do not violate my risk management parameters.
  • Opportunity comes every day. Do not neglect the work. Must do analysis every day.
  • Opportunity comes every day. Get out of poor positions. Move on.
  • I am a better countertrend trader than a trend trader. Sometimes the crowd is right, and they will run me over at those times if I’m not quick to admit I’m wrong.
  • If you’re going to do something stupid, at least do it on smaller size.


How Do You Calculate Volatility In Excel?

I received a question from a reader who asked, “Can you calculate volatility in Excel?” The answer is, yes you can, but there are a few things you need to know. Without going into too much detail here, there are many ways to calculate volatility. Two of the most common measures are implied and historical (also called realized or statistical) volatility. It is fairly simple to calculate historical volatility in excel, and I will show you how in this post. Calculating implied is quite a bit more complicated. You technically can do it in excel, but you have to impute it from an option price. In addition, there’s actually a volatility surface, or different values of implieds for different strike prices and maturities. That’s a topic for another day; today let’s just look at how to calculate a simple historical volatility in Excel.

1. Collect your raw data, in the form of a closing price for each time period. Many people do not know, but Yahoo Finance is a good source of daily data that can be downloaded into a spreadsheet. (See this example for SPY.) Your data will likely include other data points such as high, low, volume, etc, but just ignore everything except the close.

2. The first step is to convert the prices into a return series. Again, let’s not dig too deeply into the theory in this post, but prices are somewhat arbitrary. Is a $50 price a change a lot? Well, that depends on the price of the asset and how much prices usually change. Converting to returns is nothing more than changing the price series into a series of percentage changes. This is the first step in nearly all quantitative or mathematical market analysis. In Excel, start at the second price from the top in your series (assuming closing prices are in a column with the newest price at the bottom). In the cell to the  right of prices, divide the second price by the first and subtract one, as in the pic. Copy this formula down the entire column.

3. Next, find the standard deviation of the returns. The  formula for standard deviation in Excel is =STDEV(…), and takes a range of prices as an input. In the graphic, I have calculated a 10 day standard deviation of prices, but that is for the illustration only. Set your window to whatever time period you want to evaluate, and, again, copy the formula down. Twenty days is a good starting point if you haven’t done this analysis before.

 

 

4. So far, the procedure has been straightforward: calculate a return series, and then calculate the standard deviation of that series. There is one more step, which is perhaps the only part of this that is conceptually a little bit complicated. You have calculated the standard deviation of the returns for whatever the time interval of your data is.  If you have daily data, you have calculated a daily standard deviation, and so on for hourly, weekly or any period. Historical volatility is the annualized standard deviation of returns. We must multiple the standard deviation by an annualization factor, which is the square root of how ever many of your periods are in a year. This example is daily data; there are 262 trading days in a year, so we multiply the standard deviation by SQRT(262). If you are using weekly data, the annualization factor is SQRT(52), etc.

This is one example, but a slightly more complex example, with graphs, can be found step by step on the tabs in this spreadsheet. We will consider exactly what this measure of volatility is, what it does, what we can do with it, and, even more importantly, what’s wrong with it in a future post.

Ancient Wisdom / Modern Markets

One of the interesting things about writing a large book is the amount of stuff that ends up not going in said book. The Art and Science of Technical Analysis is primarily about trading, the process of trading, and reading the patterns left by buying and selling pressure in the market. One of the issues I struggled with was how, and how much, to address the psychological aspects of trading. On one hand, I wanted to focus on more or less pure market analysis; on the other hand, no trader stands any chance of applying that knowledge profitably without iron discipline and a firm mastery of the psychological elements of trading.

In the end, much of the early material I wrote on psychology and the process of trader development did not make the final cut. The good news is that I will explore much of this territory in this blog–I have insights from my experience as a professional musician, a teacher of musicians, and also my experiences mentoring and teaching traders that are very relevant. I also have a perspective that is radically different from most other educators’. Though it is certainly a reflection of my personality and my philosophy, I do not find an emphasis on competition or aggressiveness to be productive. For me, it far more valuable to understand how to read the flow of the market and then to orient myself with that flow. Furthermore, I wonder if some of the current thinking on trader development (i.e. emphasis on elite performance principles) is somewhat misguided. I have come to believe that the process of becoming a trader has parallels in Joseph Campbell’s Hero’s Story and even in Carl Jung’s application of alchemical symbolism to psychology. I will explore these concepts in the future, but the unifying concept is transformation. Becoming a trader is about the transformation of many of our abilities and traits into the skill set of a successful trader. I have come to believe that many traders who fail do so because they do not understand the nature, the scope, or the challenges of transformative journey. It is not about learning to be a trader–we grow to be traders

I have also been influenced by my background in martial arts when I was growing up, and by my formal study of Eastern religious texts later in my college years. In the process of planning and outlining the book, I collected a set of quotes from some of these ancient texts that I intended to use as departure points for sections of the book. In the end, I decided to not do this for a number of reasons. For one, it wasn’t completely coherent with the tone of the rest of the work, but, on another level, I feel the constant use of these texts in business books and seminars trivializes them in some sense. Today, let me share three of the quotes I decided not to use. I won’t elaborate on these, but I encourage you to spend some time thinking about them and how they might apply to your trading.

If you open yourself to insight,
you are at one with insight
and you can use it completely.
If you open yourself to loss,
you are at one with loss
and you can accept it completely. Daodejing-23

Do you have the patience to wait
till your mud settles and the water is clear?
Can you remain unmoving
till the right action arises by itself? Daodejing -15

The quality of decision is like the well-timed swoop of a falcon.  The Art of War

 


Managing Gap Openings

I wrote this post about understanding and clearly defining your risk; Steven Place left a seemingly innocuous comment, “i’d love to see you delve more into managing gap risk on swing plays.” That sentence highlights one of the most serious challenges facing traders: How do you deal with an overnight price movement and an opening gap well beyond your intended risk point? Though there is no one-size-fits-all answer, I’d like to consider three questions today: why do markets gap open? What are the statistics around gap openings? Lastly, we will finish with some concrete ideas for trading around gap openings

Why do markets gap on the open?

Historically, overnight gaps were a fact of life  for traders in both futures and equities. Today, more and more markets are becoming essentially twenty four hour markets, so the first issue to consider is that your gap may not actually be a gap. For instance, it is very common (and silly) to hear stock traders talking about gaps in GLD, UUP, or some other ETF product. Just because it has three characters in the ticker and you can trade it in your equity account, does not mean it is a stock! These ETF products respond to overnight price movements in Asia and Europe; do not trivialize the trading of the other two-thirds of the world into an “opening gap” when futures will give a much clearer picture of the true market. It is my opinion that most traders should not be trading these products at all. Why are you trading twenty four hour markets using an instrument that gives you access to liquidity for less than seven hours a day? If you want to trade Gold or Silver, trade futures. If you want to trade UUP and FXE, then trade currencies.

However, if you are trading a legitimate product, ask yourself if the gap is market-driven or position-specific. For instance, if the S&P futures are up 20 handles before the equity markets open, you might reasonably expect to find many of your shorts gapped through their stops. You might trade those gaps differently than if you came in with the futures down 5 handles and found one of your biotech shorts (a topic for another day…) gapped 20% through your stop. Is your stock gapping in response to broad market news, sector news, or position-specific news, and how will that affect the choices you make? These are important questions to consider before you place your first trade.

Markets gap in response to new information. This, at a fundamental level, is what all markets do: they take information, process it, and, as quickly and efficiently as possible, incorporate it into the price discovery process. A gap, especially can indicate a powerful shift in market dynamics and psychology.

Statistics on gap openings.

It is not terribly difficult to do research on gap openings. (In fact, it is a good topic for the beginning researcher because it is fairly easy to set concrete parameters.) Though the statistics are somewhat different in futures and equities, there is a clear tendency in stocks: most gaps fail. Most gaps up will lead to selloffs and vice versa, but it is not easy to trade these because the “losing trades” can be large, volatility can be high, and liquidity low. Furthermore, the high or low of the day tends to be set shortly off the open. If a stock gaps up and continues to trade up, there is a very good chance that the low of the day has been set. To compound the problem, large gap openings can often trigger trend days, in which the market opens and closes near opposite extremes of the day’s range. Those are probably the key quantitative factors to keep in mind around gap openings:

  • most gap openings fail and reverse, but, more importantly,
  • gaps have a tendency to trigger outsized trend days in either direction.
  • The action off the open is particularly important on gap days, because the high or low of the session tends to be set in early trading.

What do you do with that information?

Managing gap openings.

Let’s focus today on managing existing positions or entering swing trades on gap openings, ignoring the cases where traders specifically want to trade gaps as stand alone trades. (That’s a topic for another day.) First, assume that you want to enter a new position, but the market has gaped beyond your entry price. Depending on the trade setup, it may make sense to skip the trade; some very large gaps can invalidate some setups completely. Personally, many of my actual entries are quasi-breakout entries (though I would also argue I almost never trade pure breakouts… again, a topic for another day). If you are expecting to pay a breakout above $50.00 with a $45.00 stop, it can be very difficult psychologically to enter when the market is at $52.00 and your risk is 40% bigger… or is it?

No, there’s another way to think about this. This trade, in many cases, may actually be a better trade with the gap because the gap may indicate powerful forces driving the move. If you use the position sizing plan I laid out in this post, you will simply trade fewer shares. Even though the stop is now $7 instead of the original $5, the overall risk in the trade has not increased. This is an absolutely critical concept–please be sure you understand it. It may also make sense to massage the profit targets and trade management plan following these entries on gaps. For instance, if you enter that trade at $52 and the market trends down to close at $49, still well above your $45 stop, it often makes sense to simply get flat. (Note that this could be a failed breakout or a failure test at this point.)

However, most traders need to focus on what to do when a market gaps open well beyond the stop. You may come in in the morning and look at a loss that is three to four (or more) times your intended loss, perhaps even after the trade closed with a nice profit the day before. You better have a plan, and you better have it before this happens. These are ideas and approaches that have served me well over the years:

  • Realize that this is an event that has the potential to compromise your emotional balance. Be careful to avoid anger, fear, or emotionally driven decisions.
  • Realize that you are in a bad situation and it has the potential to get a lot worse. Fighting a single trend day on a gap against a position can wipe out an entire year’s profits. However bad the damage is on the open, more danger looms.
  • Take action early on. The right answer in almost all cases is to get smaller.  (This mantra comes from Marty Schwartz, and is one of the few things I have had written beside my trading terminal for years.) Exit at least part of the position (25% to 50%) as soon as you can. Don’t mess around–push the button.
  • Be clear that your job is not to salvage the trade. Do not add to the position and attempt to trade out of it. (Having written that, there are a very few cases where a commodities trader actually should add to a losing position on a gap opening. For 99.99% of traders and trades, this is a recipe for disaster as swings will now be magnified by larger positions in more volatile markets.) Your job is to manage the risk in a trade gone awry–don’t be a hero.
  • Place a hard stop beyond the day’s extreme. For instance, if you were short and the market gapped up past your stop, you should have bought back 1/4 to 1/2 of your position. If the market then trades down from the open, place a stop above the high of the day for the remainder of the position. Congratulations, you have just limited the damage you can do to yourself. Most self-directed traders do not have the discipline to enter this order into the market and to respect it. Most self-directed traders lose.
  • Do not add back what you have covered. Do not agonize if you could have gotten a better price by waiting. Yes, on some days this will be true. On the days it’s not true, you might have gone out of business. Again, understand your job (limit the damage) and don’t be a hero.
  • Exit the remainder of the position as the day moves on. How and where you do this is up to you, but I would encourage you to remove yourself from the decision process as much as possible. Perhaps use a trailing stop (not a platform-specific trailing stop, but something like the Parabolic or a Chandelier Stop), or just enter a MOC exit order.
  • In some small set of these, the gap failure will be dramatic enough that you will need to reenter the trade. If so, I usually think of it as a completely new trade.

Tomorrow I will show an example of these concepts at work in a recent trade in GMCR.


Current Technical Situation: S&P 500

On the close of 10/4, we (Waverly Advisors) initiated a long position in the S&P futures based on the pattern discussed in this post. (More information on the pattern and the analysis supporting the trade can be found here. I also discussed this the following day on CNBC.) I thought it might be instructive to look at how the trade played out, and to see how a conflicting setup for a short trade can help us to read market action going forward.

Take a look at the daily chart of the S&P 500 futures (24 hour session) with two trades marked.

The first trade is the long I have already discussed at some length. From a trade management perspective, my plan is fairly consistent across all of my trades. I know my entry price and the location of my stop. (In this case, the initial stop goes somewhere around the previous swing; you can make a good argument for placing it either slightly inside or beyond that swing.) I also know the actual dollar amount I am risking on the trade: I use a fixed percentage of the account’s net liquidating value (net liq), marked to market every day on close. As a rough rule of thumb, I consider risking anything less than 1% of the account per trade to be extremely conservative, and anything over 4% to be reckless. Most traders will find that a number somewhere between 1%-2% offers a good compromise between capital preservation and the pursuit of outsized profits. I am completely consistent with the amount risked on every trade within a category of trades, though some categories of trades may be done on smaller risk. In particular, aggressive countertrend trades are done half-size relative to trend trades due to increased gap risk.

The number of shares or contracts to trade is then determined by dividing the intended risk by the distance from the entry to the stop. (I will walk through this math in more detail in a future post. I just wanted to introduce the concept here.) Once the trade is entered, I consistently take profits at a point where my open profit is equal to my initial risk, or the 1X point, usually exiting between 25% and 50% of the initial trade. In this particular long, the trade cleanly reached this target, I sold part of the position, and then trailed a stop on the remainder.

Today, the market traded above the clear previous swing point, and failed in another failure test, this time to the short side. Now, the pattern itself is simple, but there are a number of other factors that add context to the trade. In this case, I believe the bigger picture technical structure remains overwhelmingly bearish; I have written this daily in my Waverly report and cautioned traders to not assume that early October marked any significant bottom for the market. Today, sector flows and the behavior of many individual stocks suggested broad weakness early on. We were able to exit the remainder of the long trade, flip to short, and then position short in several individual stocks as well.

So, to do with this information? Well, if you do watch market action intraday, you can adjust your positions as the trade develops. I came in this morning with two long positions (partial positions in MAKO and HLF, after having taken initial profits last week). As the failure test developed in the morning, I exited MAKO completely, scaled back on HLF, and entered a short in MOS and GMCR. The GMCR trade turned out to be especially fortuitous, as it hit its first profit target within a few hours. This is extremely unusual (the stock was on a -4.0 standard deviation move at the time), but it does happen. Make sure that you can make any intraday adjustments with no emotional involvement. Many traders will find better results making decisions after the market is closed.

If you do not trade individual names, then we can watch how this pattern plays out over the next few weeks to give us some insight into the conviction of the bears. In an ideal failure test, there will be several days of sharp selling this week, driving prices down toward the middle of the range. If, however, major indexes hold together and consolidate near recent highs, the stage could be set for a further advance (i.e. a failure of the failure test). In this case, the probabilities currently favor the shorts, but this can change quickly. For now, I have done all I can: I have positioned short, have taken partial profits, and will manage my risk on any rally against the position.

Simple technical patterns, placed in the correct context, have value that goes far beyond trade entries. They can actually be the keys to an analytical methodology that gives deep insight into the forces behind price patterns.


(Disclosure: I hold short positions in GMCR, MOS, December 10 Year T-Note Futures, and a long position in HLF.)

Small Stops, Big Risks?

Some of the most persistent myths about trading revolve around the idea of low-risk trades. You will often hear traders say that they took a trade because the risk was “only a few pennies” or they could use a “very tight stop” on the trade. Other times, you will hear traders say that they were justified taking a trade because it offered a good enough “risk / reward” profile. In all of these cases, traders are ignoring some important mathematical realities.

One of the challenges of trading well is learning to think about probabilities. We do not care about the outcome of any one event, or any one trade; the only thing that matters is what happens over a large sample of trades. Rather than focus on the fact that you can buy with a .02 stop, the question you need to ask is “what happens if I do the same trade over and over?”  We naturally tend to focus on the outcome of one specific event, but the ability to think in large sample sizes is one of the keys to building intuition about probabilities. This is not a natural way to think; it must be actively cultivated and developed.

Expected value (or expectancy) is a tool that can help. Perhaps the best way to think of it is that it answers what the average result of doing something over a large number of trials would be. Mathematically:

Expected value = payoff if the event happens * probability of the event happening

Both parts of this equation, the payoff and the probability, are essential. One without the other is meaningless. For instance, the payoff from getting hit by an asteroid is very bad (certain annihilation), but the probability of that event happening is vanishingly small. Therefore, most of us don’t spend a lot of time thinking about this.  What about not picking up the bread your spouse asked you to get on your way home?  This is a scenario that carries a very high probability of a bad outcome, but the consequences are not dire: the overall “expected value” of that scenario isn’t that bad.

We can also use this concept to find the “fair value” of an asset in many situations. What should you be willing to pay for a ticket in a raffle where 1,000 tickets are sold for a $10,000 pot?  Your chances of winning are 1/1000, so multiply that by the $10,000 payout to get the expected value of the ticket. Each ticket  a fair value of $10; if you are able to buy a ticket for less than that, you are playing a positive expectancy game.

You now know that the “real risk” (expected value) of a stop is determined by this formula:

real risk = loss if stop is hit * probability of stop being hit.

It is important to train yourself to evaluate the risk in any trade according to this formula, rather than focusing on the just the size of the possible loss. It is meaningless to evaluate the reward / risk profile of a trade without also considering the associated probabilities. A tighter stop will always have a higher chance (probability) of being hit compared to a wider stop–a very tight stop might be a near-certain loss. Even though the size of each individual loss is very small, over a large sample size they add up to a very significant risk. (In trading, it is possible to bleed to death from a thousand paper cuts. I know hundreds of traders who have done just that.) Limiting your risk means having a stop and respecting that stop with perfect discipline. Good risk management means using the proper stop, not necessarily a very tight stop.

For some of you, you have seen this math before, but take a moment to consider its significance anew.  For others of you, this will be new. You are lucky, because, if you can build this concept into your thinking, you can avoid many of the mistakes beginning traders struggle with. If you are going to trade well, you need to internalize this concept. Good gamblers do it. Good traders do it, and you must too if you’re going to make it in this business.

I’ll dig a little deeper into this concept in a future blog post. (I also have neglected the issue of position sizing in this post, but will address that in the near future as well.)


Two Statistical Studies

I want to share two statistical “studies” with you. Both of these were done this weekend, using the cash S&P index from 1/2/1987 – 10/14/2011. Both show a strong and convincing edge. Without further ado, let’s dig into the results.

Study #1 – Bearish Bias

Sell short on today’s close if all of the following are true:

  • Today’s close is under the 200 day moving average (indicates a weak or bear market)
  • Today’s close is the highest of the past 20 closes and the 3 period RSI > 80 (shows overextension)
  • The highest 20 day historical volatility of the past two months was greater than 40% (suggests an emotional, volatile market)

The table that follows shows the results of this system, with $1MM invested per trade, exiting on each of x days later:

Take a minute to make sure you understand the table. System results can sometimes be highly dependent on the exit point, so each row of the table shows the results of exiting on that day following the signal. We should, in general, be suspicious of a system that showed a strong edge on only a few of the days. In this case, the results appear to be fairly stable for a month (20 trading days) following the signal conditions, so it does appear, based on this test, that we might have a valid system. Winning percentage (remember, this is a short system, so that is the % of time the exit on that day is below Friday’s close), is fairly consistent, but the system is profitable on all days following the entry condition. Note especially the very dramatic Profit Factor on the first two days, showing that the winning trades were, on average, much larger than losing trades.

This system triggered another entry on Friday’s close. If we accept this test at face value, we should have gone short on Friday’s close. However, let’s look at another study:

Study #2 – Bullish Bias

Buy on today’s close if all of the following are true:

  • Today is a Friday (“seasonal” day of week tendency)
  • This week’s range was less than the previous week’s range (avoiding overextended market)
  • Both this week and the previous week closed up (positive market tone)
  • Yesterday was a down day, but today’s close higher than yesterdays (very short-term pullback pattern)
  • 20 day historical volatility is greater than it was a week ago (avoiding flatlining markets)

The table that follows shows the results of this system, with $1MM invested per trade, exiting on each of x days later:

Uh oh. Based on this test, it seems we should have gone long on Friday’s close. This system also shows a consistent edge out to the end of the test window with good percentage of wins and a stable profit factor. This system also looks good–what is going on here?

Ok, so obviously neither of these studies is intended to be valid, the point of this post is to raise a caution about statistical studies. In this case, I sat down and created these two studies in 20 minutes, knowing exactly what I was doing, but what if I just found one of them by accident? Many bloggers, traders, or analysts do exactly this, and then publish the results with conviction. In many cases, they are victims of bad math and poor research methodologies; I believe there is rarely if ever any intent to publish misleading information, but I could easily have spun either of these flawed studies into a 2,000 word research report. How can two studies show such a strong edge in opposite directions using the same data and the same entry point (Friday’s close in this case), and, more importantly, how can we avoid these mistakes?

The bad news is that there is no sure-fire way to always avoid these errors, but some guidelines will help. I am extremely suspicious of any work done by anyone else, with few exceptions. Learn to do your own studies, and you will learn to trust your results as you see them play out over many years. Also, be very suspicious of any results presented in a format similar to what I’ve done above, using a standard system output from software. There are many other questions that need to be asked, the most important of which relate to variability (tests of statistical significance) and stability over time. The biggest red flag with either of these tests are the number of trades. There were roughly 6,200 bars in the test universe, so finding a system that has less than 20 trades is not impressive. Always, always, always be suspicious of small sample sizes. (For now, let’s ignore the fact that these tests were done on the Cash S&P Index, which is not tradable per se.)

One last guideline might be helpful if you are thinking about doing your own research: Both of these tests may have too many conditions. It is very easy for an analyst who wants to prove a point (whether consciously or not) to add conditions, modify them, remove and try others until a magical combination is found. This is perhaps the main reason to do your own work: if you are trusting someone else’s tests, you usually have no idea what exact procedure was used or what subtle biases might have been introduced. If you are using a test someone else did, be very careful if it includes more than two conditions.

We’ve all heard the saying, “if you torture a dataset long enough, it will confess to anything.” With market data, sometimes it does not take that much torture, and bad statistics can lead to costly errors for traders at all stages of development.

 

If you’re interested in experimenting, here is the TradeStation system code that produced these results. Optimize for the input x which is the exit day, or set it to a specific value.


inputs: x(10);
vars: hvr(0), sprd(0), xx(0), yy(0);
hvr = hisvol(c,20) * squareroot(262);
sprd = highest(h,5) - lowest(l,5);

If C = highest(c,20) and c < average(c,200) and highest(hvr,40) > .4
    and rsi(c,3) > 80 then xx = -1 else xx = 0;

If dayofweek(date) = 5 and sprd < sprd[6] and c > c[6] and c[6] > c[11]
  and c[1] < c[2] and c > c[1] and hvr <= .35 and hvr > hvr[5]
  then yy = 1 else yy = 0;

 yy = 0;
 If xx = -1 and lowest(xx,20)[1] > -1 then sell short this bar close;
 If yy = 1 and highest(yy,20)[1] < 1 then buy this bar close;

If Barssinceentry >= x then buy to cover this bar close;
If Barssinceentry >= x then sell this bar close;

 

Careful With Correlations

One of the recurring themes of my writing is “be precise”. Too often we use concepts in ways that are not completely accurate, assuming that close is good enough, and that the lines on the screen tell a simple story. Sometimes this is true; sometimes it isn’t, but it is always important to truly understand the tools we are using. One of the most misused and abused concepts in the trading literature is correlation–traders usually assume that correlation is a measure of how two markets “move together”, but this is not exactly correct. For instance, consider the following chart of two theoretical data series. What would you assume the correlation is?

Two markets with a correlation of -1.0

If you are like most people, you would probably assume that the correlation is something very close to 1.0. Most of us work with a simplistic understanding of correlation that runs something like this: correlation can range from 1.0 to -1.0. The closer to 1.0, the more they two data series “move together”; the closer to -1.0, the more likely they are to move in opposite directions. At a correlation of 0.0, there is no relationship between the two. Several months ago, tweeted this chart with the text: “Beware sloppy ‘correlation’ studies. You can’t tell by looking at charts. These two have a correlation of -1.0″, and was deluged with replies that basically said something like, “you’re wrong. You meant 1.0.” I replied to quite a few of the respondents, but I’m pretty sure that not a single of them believed I was anything but confused. Let’s zoom in and look at a section of the data a bit more closely:

click to enlarge

At this point, you can begin to see the trick. Series ABC moves in a pattern of +1.5%, -0.5%, +1.5%… Series XYZ uses the same pattern, but offset one day. In other words, Monday ABC has a return of +1.5%, and XYZ loses -0.5%. On Tuesday, ABC now goes down -0.5% while XYZ increases +1.5%. Over time, they both go up because they are gaining more than they are losing, but the correlation is exactly -1.0 because they are always moving in opposite directions on any given day.

Granted, this is a deliberately arcane and stylized example, but it makes an important point: Don’t assume that you can understand anything about the correlation between two markets by looking at a chart. It is so easy to find examples where the author is pointing to areas, saying “the correlation increased” in certain areas because the lines moved in the same direction. Maybe; maybe not.