Hmm, today I’m learning about margin calls.

 

I’ve been familiar with the 3 day settlement period for buying/selling for a long time, though I’m terrified that I’m missing something.

I *might* be missing something.

 

Here’s the scenario:

Margin account.

Say you start out with $99k stock of XYZ with settled funds, and you have $1000 of cash in your margin account.

You sell $99k of XYZ, and then immediately turn around and buy $99k of ABC the same day using the unsettled funds.

I just realized that during the 3 day settlement period for XYZ, I am actually borrowing $99k on margin,

and that a margin call could happen during that period.

 

This happened in my algorithm in Oct. 2008 when Halliburton stock dropped from $25 to $15 during a 3 day period.

The algorithm got a margin call to sell HAL at $15 !!!

My first reaction was, "oh, another bug in my code".  Now I realize I was missing something!

2 days later HAL bounced back to as high as $23.50, but the damage was already done.

 

 

I guess the moral of the story is that you shouldn’t ever use unsettled funds?

I wonder, when you get a margin call, do you have any choice as to which stock gets sold to cover,

or does the brokerage always pick the one that was bought using unsettled funds?

 

Crap this kind of scenario is going to take a ton of logic to protect against.

Does anyone have a strategy to protect against this?

 

Also, does anyone here have an algorithm that detects which stocks are getting margin calls, and buys them?  (kind of joking, kind of seriously asking)

 

Author