Selling Covered Calls

I never really thought about it, but a good strategy would be to sell out of the money puts at your loss point depending on if you’re bullish on a stock. I always tell myself I should set stop loss orders at -5% on all my stock purchases, but I never do, and it ends up hurting my portfolio. This way, I could make some extra cash immediately from selling the contract, and the worst case is I have to sell the covered stock at the price I want!

Also, I could double that money buy selling an out-of-the-money call at my desired profit point – sure, this would be limiting my profit, which is normally unlimited, but I generally sell when I make 20-30% anyway, so why not make money on options when this doesn’t happen (which occurs more often)?

Update: I was wrong, I want to buy the puts or sell in the money calls. Selling in the money calls is a much better plan, since I can make a little premium going in, and still be protected from downside. Here’s a whole article about it.


A little options strategy

The story

I got burned by options a couple years ago, and have stayed away ever since.  But in the last few days, I’ve been learning how to manage risk using options, especially by using spreads.  I decided to try out some spreads today in my optionshouse practice account.

WARNING: If you are not familiar with options, the next part is going to be gibberish.  Use Google to find a good resource on educating yourself about options if you are at all interested, and please use a virtual account to try it out before putting real money in the market.  Cheers.

2 of them are Bull Call Spreads, which means buying a call option on a security at a realistic strike price out-of-the-money, and at the same time selling a higher-priced out-of-the-money call.  What ends up happening is pretty awesome – a lot of the cost is cancelled out since you’re buying and selling a contract, but not all of it since you’re buying the less risky option.  If the security goes down in value, you and the person you sold to lose, but your losses are less than they would be just buying a call.  On the other hand, if the security rises in value, which one who enters this spread assumes will happen, but not enough to bring the sold option into the money by the expiration date, you keep your profits.  The best part is that even if the sold option goes into the money, it doesn’t really matter as long as you keep your call around as long as they do.  If they exercise early, all the better, as you can take your profit in safety.

The other spread I’m trying is an Iron Condor.  To explain this, you need to understand what a Bear Call Spread is and what a Bull Put Spread is.  I’ve linked both of these, so I suggest you read them, especially the examples (that’s how I learn).  Now that you know that, imagine combining them.  This is what’s known as an Iron Condor.  Basically, instead of being bullish or bearish on a security, you are banking on it staying in some range.  You can manipulate this range using the strike prices of the options you buy and write.

For Example

Here’s a graph from my new favorite discount broker, Zecco:

What’s happening here is an Iron Condor (slightly modified for an upside move).  Maximum profit is obtained from the 104-112 range.  If the final price falls much outside this range, you’re going to incur a loss.  It’s best to do this on stocks that have very little volatility – like indexes.

Conclusion

We’ll see how this goes virtually, and consider trading it a bit in real life, just for kicks.


Some stock picks…

Here’s some little stock analyses I did today using QTStalker.

Google

Fibo 50% and upward trendline should help this go up a bit, assuming Android continues to get market share.

Atwood Oceanic

These guys are in a lateral channel between the 61.8 and the 38.2 Fibo lines.  Buying around $25 looks like a win.

Cintas

This looks good – a bounce off the 38.2 at the same time as a bounce off the uptrend.  Also, the RSI is getting back into buyable territory.

Intel

At less than $20, this looks pretty good.  It’s also about to hit long-term support, as well as the 50% Fibo.

TEVA Pharmaceuticals

This company makes a bunch of medication.  And look at that RSI!  It’s also had a perfect bounce off the 38.2 line, and is flirting with the 50% line.  I think this one has a bright long-term future with the mass retirement coming up.

Hillenbrand

They make coffins.  How can you go wrong in the next 20 years?

Take Two Interactive

These guys make Grand Theft Auto and a bunch of other games.  As more and more adolescents continue to play more and more video games, this stock should soar.  Also, it’s really beaten down right now, just bouncing off of major support, and it’s extremely oversold as indicated by the RSI.  Buy!

YUM Foods

Oh man.  I could go for some KFC right now.  Or maybe some Taco Bell.  Guess what – they’re both owned by one company, Yum Foods!  It’s in an upward channel right now, but currently isn’t a good buy as it’s nearing a peak again.  Wait for it to drop to channel support and buy.


Quick Markaby note about conditional attributes

Say you want to set an option tag to selected only under certain conditions without the code getting really ugly. Do this!:

I was messing around with the ternary operator in other ways inside the element, but none of them actually interpreted properly. I hope this helps someone else struggling with this issue…

Wide adoption fails originators

I think almost everyone has experienced the following phenomenon at some time in their lives: you and a close circle of friends are involved in something wonderful, and it’s ruined when the community at large adopts it. I can think of several examples: the BBS community and the Internet, the HAM Radio community and cellular phones, and early Facebook adopters and the current state of Facebook.

When I was young, I was logging into several BBSs per week, having loads of fun playing LoRD, reading classifieds, downloading free software like Frogger, etc. Then, I got Prodigy, which opened up a whole new world for my family and I. We could now access information and chat with people worldwide! I later tried several other networks, such as ImagiNation, CompuServe and AOL. I used the interfaces created by these companies to browse since I didn’t know about the world wide web yet. Eventually, Mosaic was brought to my attention, and I tried that out. Since then, I’ve really never looked back. Yet, I find myself missing the communal aspects of the BBS – no matter what, everything was pretty localized. Any upcoming meeting or party you read about was almost certainly within a 50 mile radius. The Internet has various facilities for communal postings which I won’t iterate here, but it doesn’t feel as special.

I was never into HAM radio as a kid, and I just earned my license about a year ago. Yet, now that I’m part of the community, I’ve realized how marginal it’s become. This is mainly because of cellular phones; now everyone carries a radio and doesn’t mind paying an arm and a leg for it. HAM radio has many advantages though – on VHF, you don’t get telemarketers calling you. And even if you did, the communication is broadcast-based. Cellular communication, on the other hand, is connection-based, so you either have to hang up on them, answer the call, or get the number blocked, rather than just ignore them. There are various repeaters in populated areas that you can use a bit like cellular towers. You can easily talk to total strangers who are also interested in your hobby. You can use IRLP and Echolink to connect to other HAMs all over the world for free. Many argue this last capability kills HAM radio a bit, but I disagree. The poison for a hobbyist community is not worldwide access to other hobbyist communities of the same bent, but rather adoption by the community at large, bringing in the yahoos. BBSs had ways of connecting together for chat events, MUD access, and the like, but that was awesome – it just brought like-minded people together.

Facebook has also gone through this metamorphosis, driving many of the early adopters away entirely (myself included). I got a Facebook account a very long time ago (around 2005), and just cancelled it this year. In its beginnings, Facebook was set up for colleges, and your specific school had to be added by the developers manually. You could search for and add people in other schools as friends as long as their school was also on Facebook. The communities and groups were all related to your school. It was like a little BBS, but online. Everyone loved it, obviously. Later, they started allowing random people to sign up, which completely ruined it and turned it into the new MySpace. This was a huge mistake. Now, the main point of Facebook seems to be terrible webgames. Once I received one too many invites for some zombie game, the mafia game, and the farm game, I left.

Currently, identi.ca is in the same situation in which all these other technologies began. It’s a free micro-blogging network like Twitter, but completely free and open source (and it won’t have ads like Twitter will soon). At some point in the future, perhaps people will migrate away from Twitter to places like identi.ca, which will turn it into a massive community of UNIX geeks into a disgusting online nightclub like the rest of the Internet, filled with pithy comments about the latest celebrity scandal.

So, in conclusion, call me an elitist, but there’s nothing wrong with a social network that’s not open to everyone (even if the criterion is making an effort to educate oneself). In fact, the way to ruin it is to let everyone in.  Perhaps what’s needed is an elitist network – one that only allows those who’ve proven themselves to enter.  College education was a decent way of doing this, and Facebook should have carried that forward.  This is sadly the fate of all successful technologies; they start with a small community of smart, excited developers who carry their ideas forward, only to end up facilitating the transfer of images featuring people vomiting.  But that’s what life’s all about, I guess.  I’ll deal.

Notes about Google Go

While trying out Google Go, I found out whitespace seriously matters, certain constructs you’re used to are not present, there is more than one way to declare variables, etc. This is a short collection of those observations.

Blocks

Blocks cannot have a newline between the declaration and the first opening brace.

This is a bit strange, as many people think that having all the curly braces in line is more readable, and it is a common practice in many languages to do so. I’ve recently converted to this line of thinking, but I’ll have to revert back to hanging curlies for Go. I’m OK with this, it’s just weird that it actually enforces one side of this hotly-debated topic.

Environment Variables

There might be a way to get rid of this, and I think it’s nice that you can point Go to a specific location for libraries, it would be nice if the default installation didn’t force me to update my .bashrc.

Compiling

So, to start, I realize I can use gccgo for a more traditional compilation process, but I’d like to use the most feature-rich version of the language. Why does go have 2 different binaries for compiling and linking? Also, the naming scheme, while I think I understand where they’re coming from, is ridiculous. Should I use 8g or 6g? I don’t know – why is it not go and go64? That would actually be easy to remember. For reference, 8g is for i686, and 6g is for amd64. I don’t get it. So, I’m ready to compile, and I just run 8g myfile.go right? Yes, then I have to run 8l myfile.8. Wait, if I use 6g I get a different file extension! This makes for horrendous Makefiles that I’ll have to manage somehow. Perhaps I’ll just do everything with Scons instead, since I think it wouild be a lot cleaner.

I found a great post on Stack Overflow about how to hook this thing up to Scons. I ended up with this:

Maybe someone at the Scons project will eventually integrate something like this into Scons…

Operators

So far, I’ve noticed there’s no pre-increment operator for integers like there is in C++. This is a bit annoying, but I’ll get over it.

Loops

There’s no while or do-while loops. Just a for loop. This makes me sad – I really like while and do-while loops for certain cases. I’m sure the for construct in Go is flexible enough to handle this omission, but it makes me uncomfortable at the moment. We’ll see if I like what they’ve done.

Conclusion

I like Google Go, but it’s going to take some getting used to.

Burst C++ Library

I made a little C++ library called burst. The idea is to extend the awesomeness of Boost with convenience functions for common tasks (mainly my own common tasks, but maybe others can benefit as well). The current trunk is here. Here’s a quick example:

And just that quick (3 lines) you’re sending an HTTP request to boost.org’s root page and streaming the result to STDOUT. Pretty cool, eh? What if you want a different website?

It’s nearly as easy as Ruby’s open-uri! Inheriting from it makes it even better, since you can quickly customize a web api class around the gory HTTP details Burst.Asio.HTTP.Client does for you.

Moving the mouse with Python

I’ve been using KDE4 in Ubuntu, and I really like it – it’s slick, has everything I need, and it all seems to gel together pretty well. Yet, the power management is really starting to make me angry. I’ve turned all of it off, checked ps and other tools for any signs that it’s still running, and despite my efforts, my screens still turn black after 10 minutes unless mplayer is running. So, I decided to fix that using Python, which actually turns out to be pretty nifty. I got the original idea from here, and modified it to loop a bit. Here’s the result:

This moves the mouse around just a tiny bit, and works well enough to watch flash video for extended periods of time. To kill it, just hit Ctrl-c. Thanks, Python!

Blocking Facebook’s Like Button with Squid

So, I read this story today, which says the following:

Even if someone is not a Facebook user or is not logged in, Facebook’s social plugins collect the address of the Web page being visited and the Internet address of the visitor as soon as the page is loaded–clicking on the Like button is not required. If enough sites participate, that permits Facebook to assemble a vast amount of data about Internet users’ browsing habits.

Well, that’s creepy. Even though I deleted my Facebook account, they’re still trying to collect information about me by embedding themselves in other websites. Well, that happens to be really easy to fix for my entire network running through a Squid proxy server:

# Facebook Like Button Denial
acl facebook dstdomain .facebook.com
acl facebook_like urlpath_regex -i ^\/plugins\/like\.php
deny_info error-facebook-like facebook_like
http_access deny facebook facebook_like

I also had to create this file in my error_directory: /usr/share/squid/errors/en/error-facebook-like

<p>This just in: <b>Facebook Sucks.</b></p>

Now, when I go to a site with a Like button on it, it looks like this:

But Kelsey can still get to her beloved Facebook directly! Thanks, Squid team.

How to use Ocropus to create HTML Book Scan output

Ocropus is a new book scanning software package and C++ library.  I’ve compiled it on Ubuntu Linux 10.04.  It’s rather easy to set up:

hg clone https://ocropus.googlecode.com/hg/ ocropus
cd ocropus
hg clone https://iulib.googlecode.com/hg/ iulib
cd iulib/
sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libgif-dev
scons
sudo scons install
cd ..
scons
sudo scons install
ocropus

Then, go to your directory of appropriately named book page scan images (tiff or png). When you type ls, you should see the pages list in order! Then, try:

ocropus book2pages out image*

This grooms the pages for OCR. Next, let’s make the page objects, and eventually the book:

ocropus pages2lines out
ocropus lines2fsts out/
ocropus fsts2text out/
ocropus buildhtml out/ > book.html

That should create you a nice book html file, in the hOCR format. Now, I just need to figure out how to convert hOCR to ePub!