Tuesday, July 26, 2005

Option Software Screnshots

Well anyway like I said in my last post, I wrote a real-time options probability calculator in C#. This is to aide the mechanics of evaluating potential options trades once I have a stock I am intersted in. I still need to develop software to aide the picking of the actual stocks.

Screenshot 1: The options quote and greeks (Click on the picture for a larger image)



Screenshot 2: The option probabilities (Click on the picture for a larger image)



Here's how the software works. I have a separate tabbed worksheet for each option strategy type. Currently, only 2 worksheets are implemented: Naked Puts and Naked Calls. (Straddles and combinations will probably be next.) Once you enter a stock symbol, a list of available contracts is presented to you, and a real-time quote of the stock symbol turns on at the top of the page, above the option worksheets. I would prefer to be able to load all of the option contracts for a given security in the worksheets. Unfortunately, interactive brokers limits the number of real-time quotes I can subscribe to at any particular time, and that would exceed the limits. Therefore, the contracts must be evaluated in the worksheets, one expiration date at a time, which the user can pick. There is a second set of expiration dates which is disabled. This is for the future implementation of the time-spreads worksheet.

Once the user picks the expiration date, all of the strikes with quotes are automatically selected. Alternatively, the user can choose specific strikes if desired. Once the user chooses which strikes to evaluate, by clicking the "Load Options" button, the worksheets become "alive". In the case of the Naked Put worksheet, real-time quotes of all of the puts for the selected strikes start to update, along with the computed quantities. In addition, the "cumulative-weighted-IV" for all of the strikes at the current expiration begins to be displayed. This is a weighted average of all of the contracts individual implied volatilities, weighted by how far out of the money they are, and how much volume they have traded today. This quantitiy is only updated every 5 seconds.

The first screenshot displays the basic option quote, the "greeks" from the black-scholes model, and the implied volatilities for each contract. All of these are displayed in real-time, as the quote updates. The second screenshot shows the probabilities. Most of these are also displayed in real-time, but some are computed at a fixed 5 second interval.

Profit Prob: This is the probability of profit at expiration. Given a volatility assumption, this is the probability that the stock will be above the "break-even" price for a particular naked put sale at the put's expiration.

No Touch Prob: I call the next quantity the "No-Touch Probability". This is the probability that the put will never go below it's strike between now and the expiration date. Any time the stock drops below the naked put's strike price I will definately be "sweating" and may close the trade, so it is very nice to have an idea of how likely this is ahead of time. The free web-based probability calculator I was using doesn't compute this quantity.

Expected Profit: Assuming you could make the exact same trade a large number of times, and the stock's movements were distributed randomly every time with the given volatility, this is how much money you would expect to make per trade at the expiration date. To compute this quantity, I intigrate the probability function multiplied by the option price at every possible stock price. The method of intigration I use is trapazoidal intigration, and is very basic and slow, so this quantity is only updated every 5 seconds. I'm not sure if this value is being computed accurately. The values computed seem reasonable for the out of the money options, but they seem to balloon when the option is in-the-money. I don't sell naked in-the-money options so this isn't terribly important in itself, but this reduces my confidence in the code. Until I've used the program more, and gotten more opportunities to compare the computed values to the free web based probability calculators, I won't feel very confident using this value.

Yield: This is simply how much the premium the option would yield, if the option were to expire worthless and no leverage were to be used. Basically, this is the premium divided by the strike price (and then scaled to an annualized basis.)

Expected Yield: This is the same as the yield above, but instead of the premium, I use the expected profit for computing the yield.

The controls above the options quote allow the user to change the parameters used for the calculated fields:

Volatility: The volatility assumption is the key input for all of the computations the program makes. All of these computed numbers are only as accurate as the volatility assumption. These radio buttions allow the user to change the volatility used for these calulations. By default, for each contract, the volatility used is that contract's implied volatility. Alternatively, I can specify to use the cumulative-weighted IV for all of the options, or put in my own assumption. For example, right now the implied volatility for the S&P is extremely low. So, if one were to sell a SPY naked put, it might make sense to put a higher volatility estimate than the current implied volatility, since volatility tends to mean-revert. If there were naked puts that looked favorible with the low volatility estimate, they would be less favorable with a higher volatility, so entering a higher volatility estimate would be more conservative.

Price for Calculations: This allows you to choose which market quote to use for the calculations. By default the put worksheet uses the curent bid. If I feel that it might be possible to split the bid, I could use the halfway point, or if I felt that I could get filled on the offer I could use the offer price instead. For getting the correct implied volatility, it might make sense to use the last sale price in a liquid option. After the bell, I have to use the Closing price.

Black Scholes Parameters: The last set of controls are for entering the specific values required for the black-scholes model.

Recalculate Button: After you change the black-scholes parameters, the worksheet will not reflect the changes for a particular contract until the next quote from IB forces an update. Clicking this button, updates all of the calculated values immediately.

Weighted IV: This is a weighted average of all of the contract's implied volatility, where each IV is weighted accourding to the volume of contracts traded so far today, and it's distance from the underlying stock's current price.

The Mechanics of Making a Trade (software screenshots postponed)

I wrote an application in C# that interfaces with my brokerage's software to compute option probabilities and greeks in real-time. At the simplest level, this application is a substitute for excel, and various free web based probability calculators I use. The application goes further though. It computes quantities that I previously couldn't, using excel and web based calculators. The progam should also prove to be a huge time-saver, by eliminating the need to manually enter values into excel and by removing the need to visit various web-sites. As the program evolves, I see it developing into a general-purpose option strategy evaluator.

Before I get into the screenshots, let me explain a little about the actual mechanics of how I enter a trade, so that it will be clear what the purpose of this program is. Say, I'm interested in entering a bullish position in a stock. The first thing I'll do is check out the options and see if there is a way for me to modify my risk/reward profile by selling puts or going long calls. For example, if implied volatility is high, and the market is fearful, high-yielding puts with a high probability of profit may have a high expectation (based off of the statistics, not necessarily the reality) of profits. So, since I hate taking losses, I might choose to sell those puts with a high probability of profit, if I think the market is too fearful of a large move to the downside.

Often if I'm interested in a entering a bullish position in a stock and I don't find "good" puts to sell, I'll forget about it. This is because even if I do have a "bullish" opinion, it usually isn't a very strong one, and so I feel that I should also have the extra "edge" of selling expensive volatility. Furthermore, I like to be able to have a high-frequency of profitable trades, which selling out of the money options gives me.

Now, if I really have a strong opinion and I don't see puts with a good probability, I will often buy deeply in the money calls as a substitute for stock if the trade is a short-term one. This gives me a degree of downside protection if the stock should make an unexpected extreme move, although in practice the option is far enough in-the-money that if the stock were to move enough so that that downside protection actually kicks in we'd be talking about a catastrophic move and I would be taking huge losses nevertheless. The main reason for using the deep in-the-money calls is not for loss-protection. It is so that I don't tie up a lot of capital for the trade. This used to be my "bread-and butter" trade...but this year I have not been very successful speculating with in-the-money options. I think this is partially due to the fact that I have generally been puting on larger trades than I used to when making these types of trades, and this has clouded my judgement. Come to think of it, I'm not even making these types of bets in the same types of scenarios that I used to. (I just had a major epiphany here. I'll try to remember to make a blog post later.)

Sometimes when I check out the options for a stock (I'll use a bullish example again), I find that out-of-the money or perhaps at-the-money calls have a high expectation of profit relative to the amount of money that needs to be put down to buy the calls. If it is a stock that makes explosive moves, I might be inclined to place a low-cost bet. This is a low-probability trade, meaning more than likely I'll lose money. The potential reward though is high. This is usually a longer-term strategy for me. (6 months or more.) This is a newer strategy for me, and I have not taken any profits yet using it so I don't know how well this is going to work for me. So far I am showing an unrealized profit on my long-term call purchases.

The final type of trade I make are the very long term stock purchases that I make. I don't even look at options for those trades.

Well, I meant to show you screenshots of my software...but I seem to have filled up this post talking about the mechanics of how I place an option trade. Since this post is allready long, I will make another post about the software specifically.

Thursday, July 21, 2005

2 Months Profit lost in 2 days

I closed out the INTC and STX trades today. Yesterday, I was proud of myself for not selling into the early lows for the day. The stocks recovered later in the day, so I decided to let another day go by before closing them. That was a bad choice in retrospect. The stocks were both down more today, especially STX. This fiasco represents a loss of almost 2 months profits in 2 days. I need to refocus on what has worked for me, and shrink my trade size. The VIX was up a fair amount today. Maybe it will be time to start selling puts again soon. I am nervous about selling options short. It seems like it has become such a popular strategy now-a-days. It has been too long since anyone famous has blown up, selling options. I would feel more confident if my tools were finished. I did finish up the real-time put worksheet that I started (and came close to finishing) over the 4th of July weekend. It is usable now, but still has a few kinks. (I will post screen-shots, once I figure out a good way to host the images.)

One thing is for sure: I will not be listening to Cramer on anymore short term trades. I think he may be too visible now to make effective short-term calls. I'm still happy with the long-term picks he has gotten me into. (Especially SHLD!)

Tuesday, July 19, 2005

Infected by Cramer's Madness?

Today, Cramer wrote in an article to buy INTC,MOT, and STX today all ahead of earnings. I bought INTC Aug25 calls @ $3.91 and STX Aug15 calls @ 4.71. I was almost to embarrased to write on this blog that I was following one of Cramer's calls, but if I don't write it down and experience the shame how will I ever learn? In the past, I've generally made good money following Cramer when he has made wildly bullish calls right before earnings. It seems lately, mainly this year, trading [short-term] his market calls on realmoney.com haven't been as good as I remember in the past. Maybe if I lose money on this, it will be the catalyst to stop listening to him. It looks like intc just announced, and is getting a sell-the-news reaction, after hours.

I also subscribed to realmoney.com's 30-day free trial to their options newsletter and put on the 2 recommended trades in SPY. They are doing a different type of trading than I usually do, so this might be a good opportunity to get some experience using strategies I don't use very much. The only problem is that I have to make slightly bigger trades than I would normally do when I am experimenting with new ideas since they will be "trading around" positions so I need enough contracts to be able to do that.

Monday, July 18, 2005

The Right Tool For The Job

When I was 10, my Parents purchased a then state-of-the-art IBM AT Compatible 80286 computer with the 80287 math co-processor for our family. I was fortunate at that age to have a computer. I was the only kid I knew actually who had a computer. Back then Intel CPU's couldn't do floating point calculations natively. The calculations had to be emulated in software which was very slow, unless you had one of the expensive x87 math co-processors. The 80486 was the first intel CPU to include a floating point unit built in.

Why back in oh 1989 did we need such a high-end computer? My Father was a statistician, and needed to run a statistical programming package called SAS on our computer. It required a math co-processor. My Mother was a CPA and needed to run a program called LOTUS 123 on our computer which didn't require a co-processor but it benefitted from one.

In 6th grade, my math teacher was really into computers, and believed that it was important for our education to know how to use them. His classroom was full of those old style Apple computers. (They were hardly ever used for anything other than playing "Oregon Trail", and "Where in the World is Carmen Sandiego".) At one point, he tought us how to use a spreadsheet on those Apple computers, and after that point we were allowed to do all of our math homework using spreadsheets if we wanted to. I was actually the only kid in the class who took him up on this. I had my mom show me how to use Lotus 123 on our home computer and from that point on I did almost all of my Math homework in Lotus...which made it pathetically easy. I didn't learn much math for the rest of the year (which hurt me in 7th grade), but I did learn how to use a spreadsheet pretty well.

In my Freshman year of college, our chemistry lab instructor encouraged us to do our Chemistry labs using spreadsheets. Despite the fact that I knew spreadsheets backwards and forwards, for some reason I never did use a spreadsheet for my chemistry labs except for the one or two labs for which it was explicitly required. I recieved a barely-passing D+ my second semester of General Chemistry. ("D's get degrees!") During my sophomore year, I took physics. The physics lab-instructor also encouraged us to use a spreadsheet for our lab experiments. For whatever reason, perhaps because I liked my physics lab instructor better than my chemistry lab instructor, I listened to his advice, and did all of my labs using Microsoft Excel. I enjoyed the Physics labs, and I got A's. It was great, but it also sucked because I realized that if I had been using Excel my freshman year (which was very tough for me) I would have had so much more free time, so much less stress, and I know I would have learned more and recieved a much better grade in Chemistry. The lesson was learned, and from there-on, I always did the calculations for my labs using Excel.

My Chemistry advisor and my math professors started to encourage their students to learn to use a program called Mathematica during my Sophomore year of college. I never really bothered. By the time of the second semester of my Senior year, I only needed one more class to complete my Chemistry degree: Quantum Mechanics. The class happened to be taught by my Chemistry Advisor. He basically required that we use Mathematica for our assignments, labs, and tests, so I became fairly proficient in the use of Mathematica. With Mathematica, Quantum Mechanics was intresting and fun, and I did well in the class. However, I had the same feeling of regret that I had experienced my sophomore year when I realized how easy Excel had made my lab assignments: "Arrrggghhh! Why didn't I learn to use Mathematica sooner!" What a shame. It would have made allmost all of the classes that were hard for me easy, and would have freed up so much of my time.

I've noticed that as I study option trading, statistical calculations are usually required. Hopefully if I learned anything in college, it was to not make my life harder by refusing to learn and use software tools that are readily available to me. So in that spirit, I have decided to learn to use a statistical package called "R". R is an open-source implementation of a statistical programming language called "S". This is very much similar to the program SAS I mentioned earlier that my Dad used to use when I was younger. I ordered the book Introductory Statistics with R from amazon.com, and I am currently working through it. Assuming I am able to easily access my data, I think this will turn out to be an excellent platform for experimenting with options trading systems.

Sunday, July 10, 2005

Another day, more bad trades.

The bad trading in the gamma-scalping experiment continues. I don't even want to write about it. I'll just summarize it like this. I'm leaning short into this powerful market. (On the experiment that is...overall my portfolio is very much net-long.) Instead I'll write about my programming progress.

It is surprising how difficult it is to simply move a little data from one MySQL server to another. The standard tool mysql provides for some reason just didn't work for me. I have 2 windows GUI tools...MySQLFront and Navicat. They are both patheticly slow. Obviously neither is intended for large databases. I wanted to move all of my existing equity data off of my main computer to a separate Database server I set up. Then, my plan was to re-import my option data from stricknet on that server. Transfering the equity data using Navicat took 3 or 4 days. (To re-download all of that data from finance.yahoo.com wouldn't have taken much longer than that.) Then I began the options data import. This took about 48 hours.

There is a silver lining though to this long and tedious data import. During the time that my data was importing (especially over the 4th of July weekend.) I started working on my real-time options analysis tools again, and I made excellent progress in a short amount of time. What the program does, is for an entire put options chain, it computes the implied volatility for each contract plus the cumulative weighted volatility for the chain, and then computes all of the "greeks", plus the expected return, probablility of profit, and the probability of the strike never getting touched, all in real-time, for an entire options chain, and then I can sort the chain by any of those statistics. I can also plug in my own volatility estimates for comparison purposes.

The program is about 90% done. Unfortunately I won't get a chance to finish it up for at least a week. In the future, I plan on adding a custom tab page each common options strategy Right now I only have a page for selling naked puts, since this is the strategy I use most often. I also want to add a tab page for analyzing the volatility skew in real-time. So far, I'm very proud of how the program has turned out. I hope to be able to post screenshots of all of the options analysis software I've written soon after I get back from my business trip.

Thursday, July 07, 2005

So busy...

I've been very busy with my main business (writing niche software applications) , preparing for a business trip so I haven't been able to blog much. Here's a round-up of what has been going on.

My trading lately has been piss-poor. Remember those RIMM puts I covered ahead of earnings? The stock dropped hard after earnings...yet the RIMM puts also dropped due to the volatility crash. This was a good lesson in the post-event implied-volatility crush. I'm still not sure whether it was a good decision to close the position out or not. Hey, I shouldn't complain about making money I guess, but when has that ever stopped me?

The main area where I have been trading poorly though, is the gamma-scalping expiriment. I need to decide whether I am position trading or if I am actually going to scalp the gamma. I wrote that I had hedged my position to delta-neutral by shorting some SPY shares when the market was up about a buck. I then had at least 2 chances to make round trips for a profit of around $20 each time, but I felt very strongly that the market was heading down and so each time the market was down to where I had previously determined that I would re-balance to delta-neutral by covering my short SPY shares...I heald onto them and the market rallied back to around where I originally shorted. Then after Teusday's big rally, I decided that the market was too strong, and I covered at a loss of around 10 bucks. Then on Wednesday I changed my mind and decided that I needed to really give this gamma-scalping a try, so I hedged back to delta neutral by selling 38 shares of SPY short again. That turned out to be a good trade. Thurseday morning after the London Terrorist attack I covered this time and made about $45. It's a good thing I covered. The market was strong all day. The thing is...I still feel the market should be heading for a short-term down move....next time I short to get delta neutral (assuming the market goes up first) will I decide to play it as a position trade, or will I stick with the gamma-scalping plan? I don't know. Furthermore..what if I buy stock to hedge to delta-neutral in the down-turn and I miss out making the big money on a big down move because I was hedged?

It's funny how even though this is a small experimental trade, I still succomb to all of the usual greed and fear emotions . This is why I have to have some money on the table when trying out a new strategy. Without the emotions of having actual money on the table, it just isn't real enough. I wouldn't pay as close attention to the trade if it was just simulated, and even if I did, I wouldn't be able to have this kind of emotional reaction during simulated trades. Part of learning to trade a new instrument or new technique is mastering the emotions that come up. I find that eventually I come to a point where I just "feel comfortable" and can make my trades rationally. So far it does seem like if one stuck to the plan, this gamma-scalping could be very effective.

One really good trade I made last week was selling some UNH July 50 puts short. They had such a great yield and expected return over only 15 days that they seemed almost too good to be true. After I sold them, even though UNH seemed to be going up, the puts hardly lost any value. Presumably the implied volatility was increasing during this time (I haven't looked at a graph). I think I checked on finance.yahoo.com and saw that an earnings announcement was coming just prior to expiration. I've traded UNH options a lot and this seemed like unusual behavior for UNH going into earnings, but I just accepted that the earnings must be the reason for the dramatic IV increase. Well, then on Wednesday UNH was halted because they announced an acquisition. So I guess someone knew ahead of time and that is why the IV was moving up so much and why the expected yield on those puts looked so nice. It's a good lesson I learn over and over again...often options are "over-valued" for a really good reason...something big is about to happen. The nice thing is, it never has really hurt me much when this has happened. It seems that often in my case even though the options market has anticipated news...the level of fear has been too high.

The stock was halted most of the day. Usually the (acquiring) stock goes down after the company announces an acquisition because it dilutes the existing shareholder's equity. I wasn't really worried though. My puts were enough out of the money, that the market would have had to really hate the deal to drop the stock enough for me to lose money. The deal was not particularly large, and people generally like this company. The stock seems like it only goes up and up and up, with relatively little volatility. That's the kind of stock, shareholders are willing to forgive if the company does a bad-acquisition. Furthermore, I had a feeling that even if the stock sunk, in the evening Cramer would have UNH written on his knuckles as this is one of his favorite stocks. It seems like lately, Cramer has been able to move even big stocks (Even though, I'm a little skeptical that he was solely responsible for the big CSCO move...) with his television show. I was hoping that this would be enough to keep me above the strike until expiration. Little did I know he was on vacation and so there would be no stock-pumping Wednesday night even if I needed it. It turns out to have been a moot point though. UNH actually moved up once trading resumed! The puts plunged in value. I am now patiently waiting for expiration to squeeze the last dime out of the puts.