Site Meter The Lawyer Trader: April 2012

Saturday, April 28, 2012

General Update and a ThinkScript Code

I almost let an entire month go by without posting...just a sign of how busy (crazy) my world is right now.  Recently, I opened up a Title Company and that has been eating a lot of my time.  Generally, you won't hear me comment on real estate because this blog is about trading, however, the title company is a play on the overall real estate market.  Here in North Texas, real estate is really beginning to pick up.  Real estate agents are seeing lots of activity on the residential side and commercial spaces are filling back up as well.  The title company seemed to be the most direct way to really profit from a rebound.

On the trading side of things, I've been working on a couple of mechanical strategies that are designed to be traded with a basket of commodities.  Nothing too fancy, a simple trend following model and a mean reversion model.  The hard work is in determining how to measure different markets to establish which commodities to include in each system and then how to allocate to each system as a whole.  For example, if my measurements are telling me that volatility is steadily declining and certain commodities are trending, then I may allocate 65% of the overall portfolio to the trend following system and 35% to the mean reversion.  Sounds easy enough, but developing and testing rules is a tedious process.  I'll be providing some posts on this is the future.

Over the past month, I've been in talks with a local hedge fund manager that runs an options trading fund.  He has an interesting strategy that returned about 7% this month...generally he targets 1-2% a month but the volatility in the beginning of April really helped him out.  We are working out a deal that involves a couple of entities partnering up to form a new fund that trades a "Collared Dividend" Strategy.  If this comes together, the new fund looks like it will have $30-50 million to trade by the end of July.  At this point, this might be a pie-in-the-sky dream because there are many working parts that still need to get figured out...but, the thought of managing some institutional money sure is exciting.  

Before I sign off, lets take a quick look at the market.  Below is a chart of S&P 500 via SPY, and it has my Spec Stocks Indicator attached to it.  The premise is pretty simple:  select 6 stocks that are popular and speculative and take a measurement of the trend for each stock.  Then put it together and take an average of them.  These stocks tend to lead the market and be indicative of investors' willingness to take on risk.  Here's the chart:


And for any thinkorswimmers out there, here is the ThinkScript code:

//

declare lower;

input symbol1 = "aapl"; 
input symbol2 = "goog";
input symbol3 = "bidu";
input symbol4 = "cmg";
input symbol5 = "nflx";
input symbol6 = "pcln";
input malength = 200;
input malrlength = 5;
input shortmalength = 50;
input longmalength = 200;

def S1 = close(symbol1, period = "Day");
def S2 = close(symbol2, period = "Day");
def S3 = close(symbol3, period = "day");
def S4 = close(symbol4, period = "day");
def S5 = close(symbol5, period = "day");
def S6 = close(symbol6, period = "day");

def ma1 = ExpAverage(s1, malength); 
def ma2 = ExpAverage(S2, malength);
def ma3 = ExpAverage(S3, malength);
def ma4 = ExpAverage(S4, malength);
def ma5 = ExpAverage(S5, malength);
def ma6 = ExpAverage(S6, malength);

def MALR1 = linearRegressionSlope(ma1, malrlength);
def MALR2 = linearRegressionSlope(ma2, malrlength);
def MALR3 = linearRegressionSlope(ma3, malrlength);
def MALR4 = linearRegressionSlope(ma4, malrlength);
def MALR5 = linearRegressionSlope(ma5, malrlength);
def MALR6 = linearRegressionSlope(ma6, malrlength);

def MALRMAShort1 =expAverage(MALR1, shortmalength);
def MALRMAShort2 =expAverage(MALR2, shortmalength);
def MALRMAShort3 =expAverage(MALR3, shortmalength);
def MALRMAShort4 =expAverage(MALR4, shortmalength); 
def MALRMAShort5 =expAverage(MALR5, shortmalength); 
def MALRMAShort6 =expAverage(MALR6, shortmalength); 

def MALRMALong1 = expAverage(MALR1, longmalength); 
def MALRMALong2 = expAverage(MALR2, longmalength);
def MALRMALong3 = expAverage(MALR3, longmalength);
def MALRMALong4 = expAverage(MALR4, longmalength);
def MALRMALong5 = expAverage(MALR5, longmalength);
def MALRMALong6 = expAverage(MALR6, longmalength);

Def BuySell1 = if MALRMASHORT1 > MALRMALong1 then 10 else -10;
Def BuySell2 = if MALRMASHORT2 > MALRMALong2 then 10 else -10;
Def BuySell3 = if MALRMASHORT3 > MALRMALong3 then 10 else -10;
Def BuySell4 = if MALRMASHORT4 > MALRMALong4 then 10 else -10;
Def BuySell5 = if MALRMASHORT5 > MALRMALong5 then 10 else -10;
Def BuySell6 = if MALRMASHORT6 > MALRMALong6 then 10 else -10;

plot SpecScore = buySell1 + buysell2 + buysell3 + buysell4 + buysell5 + buysell6;

plot zeroline = 0;

assignPriceColor(if specscore > 0 then color.green else if specscore < 0 then color.red else color.blue); 
//

Have a great weekend.

TLT