Showing posts with label strategy. Show all posts
Showing posts with label strategy. Show all posts

Wednesday, September 7, 2011

Swing trading in a high volatility environment

 Today, an alert reader asked the following question:
Michele, a quick question.


I have been reading your posts regularly for a few weeks now and was curious...


"How can I take advantage of your great analysis if I am unable to trade outside of market hours?


Specifically, gaps on market open usually kill me as I have no way of knowing what direction it will go.


For example:


- Gap up, fill gap going down


- Gap down, fill gap going up


- Gap up, continue up (uh, today)


- Gap down, continue down


Some of this probably makes no sense since I am not sure exactly how to ask the question...


Also, since I am not trying to day trade, but swing trade. The current market is making swing traders day trade because of the near daily reverses in the market... it is exhausting.


Thoughts?"
Well one of the advantages of being a night owl is that I always completely ignore the first hour of trading.  I have to - I'm asleep (hey you gotta sleep sometime).  The first hour is simply too chaotic (IMAO) to place good swing trade entries or exits.  When I first started trading, I used to get up early and be rarin' to go, counting down the seconds to the opening bell.  Then I'd start placing trades.  And I'd invariably end up getting my head handed to me.

So I stopped trading that way.  Instead of trying to day trade off the open, I switched to swing trading, holding positions anywhere between a day and a few months.  This also has the advantage of not having to worry about the pattern day trading rule.  That's not an issue for me now, but it was when I started out.

Instead, I place my most of my stock trades around noon, once the direction for the day is established, or right before the close.  That seems to work better for me.  Once I started doing this, I stopped losing money.

I trade ES differently though, and I have to ask about your statement that you are "unable to trade outside of market hours"  Why is that?  If your broker does not offer extended hours or overnight futures trading, then you need a new broker.  Or is there some other reason?  I place my ES trades anytime after the close, usually very late, like around 1 AM, but sometimes around 8 PM.

I've been documenting this in my "ES Fantasy Trader" section which I started last month.  I call it the "Fantasy" trader because I'm trading 10 contracts at a time, something I can't do for real.  But this seems to do pretty well (so far, knock on LCD flat panel).  Here's what will appear in tonight's daily post: 
"The ESFT closed out last night's trade today at 1187.25 for a 21.25 point profit, or $10,625. Account total now $138,375 since inception with $100K on 8/18 after 10 trades; 7 wins, 3 losses."
The ESFT makes money by capturing the large moves that occur in the opening minutes of the trading day, without having to place bets during that time.  I exit trades during the day once the major move is over.  It's like riding a roller coaster: you get on and off at the station with the cars stationary and level.  You don't try to jump on or off when the thing is screaming down a hill at 90 mph.  So far, I've got a 38% gain in three weeks.  (Past performance, future results, blah blah disclaimer).

But that begs the question of how to use my calls to trade stocks during the regular session.  My best answer would be that, once the first hour has gone by and the dust has settled, if I'm looking for a higher close, you might be looking for an intraday pullback as a chance to go long, and vice-versa.

For example, last night I said we'd go higher today.  I've had my eye on Intel and AK Steel lately.  Here's my trading for the day:

BOT    100    INTC    Stock    19.99    USD    ISLAND   12:37:42
BOT    100    AKS     Stock     8.72    USD    SMART    12:55:55

They're both up right now from where I got in (knocking again on the LCD).  I'm going to hold these until I get technical sell signals.  I left some money on the table by not buying at 9:30 AM, but I also reduced my volatility risk (which is something to consider when the VIX is north of 30!)

So I guess the bottom line is don't worry about gaps up or down right out the gate.  Let the dust settle and then jump in on the side of the daily market bias.

As far as your comment that  "The current market is making swing traders day trade", I have to disagree.  No one is making you trade.  The higher the VIX goes, the less I trade.  Today is the first trade I've made in two weeks, and I'm not feeling all that good about doing it.  But you're right about the effect of the VIX on swing trading.  My response is not to shorten my trades, but to lengthen them.  Day trading is too hard and too risky for my taste right now.  I prefer to wait out the crazy daily ups and downs and wait for longer term moves in an environment like this.  Patience is the key.

Well I didn't really mean to be so long-winded, but it's an important topic that touches on points I've been wanting to discuss anyway.  Thanks for the opportunity..  I just hope that answered your questions.

Monday, September 5, 2011

How to Set Stop Orders in the Stock Market: A Quantitative Analysis, Part I

Introduction

     Trading as War

To throw or not to throw...
Stock trading is often compared to war. Your dollars are your soldiers and your various order types are your weapons. If the buy limit order is your basic M-16 rifle, then the stop order is surely the hand grenade. Used improperly stop orders can be at least as deadly to you as to the enemy. And far too many people end up throwing the pin while holding onto the grenade, with the predicatble unfortunate results.

     Stop order considered harmful? 

For that reason, there's a whole school of thought that argues against using stop orders entirely. However, I don't want to get into that debate today. If you've already decided that you want to use a stop order, just where exactly do you place your order so that it will protect you and not blow up in your face?

Place the order too close to the market and you are likely to get stopped out on noise, only to witness your stock then  take off without you on board. Placing the order lower reduces the effects of noise but increases the damage to your account should your grenade go off. They say "Your first loss is your best loss". But they also say "Beware the death by a thousand cuts", meaning that a lot of small losses can kill you just as dead as one big loss. How to reconcile these two conflicting aphorisms?

There's a nice article on the subject over on streetauthorithy.com called Setting Stop Loss Orders which gives a good overview of the problem but it doesn't really give you a good method for choosing stops. In fact, there's a lot on the web about different techniques for setting stops using technical analysis or price calculations, but I've not found any objective analysis of just how well stops work and if they actually do more harm than good.

I should add that here we are concerned only with stops that are placed on opening a trade to limit potential losses, not trailing stops the follow an already profitable trade in an uptrend.

The Experiment

     Method

I decided to conduct an experiment using one week's worth of one minute OHLC data from the ES e-mini futures, 8,367 bars between 3 PM August 25th, 2011 and the close on September 2nd. The experiment is simple. We will place orders to buy ES using the BASH algorithm (Buy Anywhere, Sell Higher) at every bar in the data set. If the price then moves higher, the order is considered a winner and we move on to the next bar and place a new trade.

For the purpose of this experiment, we are not interested in when to close out a winner, just what to do when the action goes against you. If the next bar after entering a trade is lower, we set a series of stops at quarter point intervals. The trade then continues until one of two things happens: either the price reverses before the stop is hit and continues higher back above the purchase price and the trade is then considered a winner, or the stop is hit and the trade becomes a loser. We then total up the number and size of losers at every stop level.

ES one minute closing prices, 8/25/11 - 9/2/11
The question we want answered is simple: What stop level produces the smallest total losses over the entire week of data? First, let's look at the raw data.  It looks pretty much like any graph of stock data.  To quote our fearless President and stock guru, B. Obama, "the market goes up, the market goes down".

Each trade was entered on the open of each one minute bar.  Decisions of whether or not to take a stop loss were made on the closing value of subsequent bars.  Any losing trade that was still running by the end of the data set (which is when trading stopped at the end of last week) was considered to be a loss.

Obviously we want to buy the dips but when you're on the right edge of the chart, it's not so easy.  So our experiment will buy every single candle and see where the resulting 8,367 trades sort out at quarter point stop increments from 0.25 to 25 points.  The entire program is coded in Matlab.

     Results

No. of losing trades vs. total loss at different stop levels
Here are the results.  The blue line shows the number of trades that got stopped out at each stop level.  The stops were tested in quarter point increments, the smallest increment that can be used when trading ES.  The green line shows the total amount of the loss at each stop level in points.  I don't know about you, but I found the results to be just a bit surprising.

The primary result is that the wider your stop, the less often your stop gets hit.  That may seem like something you already knew, but it is not necessarily completely obvious.  It is also interesting to observe that this effect does not decay linearly, but rather parabolically.

The curve flatted out after 11 points.  Setting a stop greater than that did not cause you to have fewer losses, but did continue to increase your total loss.

But perhaps the most interesting result is that the total loss curve is monotonic increasing.  The implications of this are discussed below.

     Discussion

I must admit that I was somewhat surprised by these results.  I had always assumed that setting a very narrow stop wasn't a good idea, but apparently the old advice, "Your first loss is your best loss" is exactly right.  It turns out that you will lose the smallest total amount in a day trading type ES trade by setting your stop at 0.25 points, the smallest stop possible. You will have lots of losses, but they will all be small.  And the key point is that taking fewer losses by using a wider stop does not reduce your overall loss, it increases it.  Thus the idea of the "death by a thousand cuts" is disproven.

However, since the smallest stop is apparently the best, the issue of commissions, which I ignored for this experiment, becomes important.  I really hadn't expected that.  My broker charges $2 per ES contract, or $4 per round trip.  With a 1/4 point stop, more than half your trades will be losers.  That means you need the remaining ones to do more than double that to break even.  A 1/4 point gross gain is $12.50, less $4 commisions = only $8.50 profit.  But a 1/4 point loss is -$12.50 less $4 commission = a $16.50 net loss.  Therefore, your winners have to be at least half a point.

The other important issue is the spread.  During the day, ES provides enough liquidity that the spead is usually just 1/4 point.  However, there is no way to tell from OHLC data whether the prices reflect trades that occurred at the bid or at the ask.  With tight stops, that makes a difference.  And if you can't buy on the bid and sell on the ask, you need to add another quarter point to ensure a winning trade.  Setting a quarter point stop may prevent that from happening.  Taking the smallest possible loss doesn't do you much good if that also prevents you from making a profit.

     Future work

This wasn't supposed to be a master's thesis, so I'm going to wrap it up here and come back to it in Part 2 later on.  The remaining questions that need to be addressed are:

1. How do commissions affect the results?

2. How does considering the spread change things?  I think to answer this, I will program the BASH algorithm for my trading program and see how it does on live data trading ES.  While still not as good as real trading, paper trading is at least better than using static historical data.  And my broker's paper trading system works pretty well.  (I don't really have the nerve to try this for real).

3.  Why does the stop loss curve not decay linearly and what implications does this have on choosing stop levels?

4. And of course the big question: where is the ideal stop level, really?  With commissions and spreads, it's probably not a quarter point.  But it's definitely not 10 points.  The answer then lies somewhere in between.

I also want to look at other types of data, like SPY or individual stocks.  In the meantime, I think there's certainly some food for thought with the results so far.

Sunday, January 2, 2011

How to profit from the next flash crash

"In confusion there is profit"
Tony Curtis, Operation Petticoat

Looking back on 2010, probably the biggest event was the now infamous "Flash Crash" of May 6th, a mystery that still hasn't ever really been satisfactorily explained. The big question is how to protect yourself from the next Flash Crash. That one, fortunately, is easy: just don't use stop loss orders. If you have to put in some sort of stop order, make sure it's a stop limit, not a stop loss. That way, you'll be guaranteed of getting your price, though at the risk of not getting executed at all. However, as the Flash Crash of 2010 demonstrated, the risk of guaranteed execution provided by a stop loss order proved to be disastrous to many investors.

As for me, I just happened to have been out running errands that day. I didn't even know it had happened until I came back and looked at my charts. At first I thought it was just a bad tick - that happens sometimes. But then I noticed that everyone had "bad ticks". Then I read the news. Fortunately, I had no stop loss orders in so it was all pretty much a non-event for me.

But I digress. So how can we make some quick money from the next Flash Crash? Assuming there will be one, of course (and a surprising number of people think there will). Simple: just put in some limit buy orders for stocks you'd love to buy on sale at ridiculously low prices. They'll just sit there, like underwater mines, patiently waiting for some unsuspecting ship to come by and then ka-boom, you've got a bargain.

The only question is where to place your order. During the last Flash Crash, the SEC ended up busting trades that went through at over 60% price drops, so make sure you don't put in a number lower than that. No point in buying GE for a penny if the trade simply gets busted an hour later. And make sure you have enough cash around to cover the trade if it should ever happen to go off. You definitely don't want to do this on margin.

This is a low probability/low risk/potentially high reward play. At worst, you won't ever get your price, but then you're no worse off than now. Or the SEC might decide to bust 50% trades next time, but then you still don't actually lose anything.

The only real risk is in the case where a company really does drop 60% in a flash but for a good reason (the CFO is caught embezzling funds, the company goes bankrupt, etc.) Then you will have bought in at a price that's not likely to come back (although even then, stocks that fall off a cliff often have a dead cat bounce the next day, so you could still possibly at least break even). And that's relatively rare.

So the moral is to only do this with strong companies. Don't try this with drug companies that are always just one FDA ruling away from disaster, nor with airlines that face similar "sudden death" risks. Just a thought.

Wednesday, April 28, 2010

Sun Tzu and the Art of Trading

One of the most popular metaphors for trading is that it is like war. And one of the most famous military strategists was the ancient Chinese general, Sun Tzu. His work, The Art of War has become as much a staple at business schools as in military colleges.

If you haven't read this, you owe it to yourself. The whole thing is available online, for example at:

http://www.sonshi.com/learn.html

For a quick Reader's Digest condensed version of some of his more well-known quotes, you might check out:

http://en.wikiquote.org/wiki/Sun_Tzu

Here's one I like:

It is said that if you know your enemies and know yourself, you will not be imperiled in a hundred battles; if you do not know your enemies but do know yourself, you will win one and lose one; if you do not know your enemies nor yourself, you will be imperiled in every single battle.

The parallels to trading are obvious and the lessons are just as true.

Here's another good one:

Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.

When you trade, you are the general in command of your own army. Every dollar in your trading account is a soldier. The enemy is all around. I've found over the past two years that by learning to lead my troops more wisely I've come to achieve more victories and fewer defeats. And I owe a debt of thanks to Sun Tzu.

Market update: I'm looking for a rebound tomorrow. It may not hold, but I went long ES at 1182.50 at 1:39 AM. We'll see where it is in the morning.