Friday, 27 April 2012

Week of 2012 AL 27

SPY rose by 2.0% this week, while my account fell by 1.5% to its lowest value ever.  My loss floor dropped by 3.5%.

US market news: Tuesday night, Apple released their earnings, which were very good indeed.  Wednesday morning: the market zoomed!  Thursday night, Amazon released their earnings, which were pretty good.  Friday morning the market dropped, then recovered.  I expect continued upward momentum next week, because Apple is basically driving the entire US market these days and typically the post-earnings euphoria lasts 8‒10 days.

Thursday’s cash allocation:
Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Fri Mon Tue Wed Thu Fri │ Beg   End │
 
TNA#0  AL17 │ -3.7  14 -7.5  14 -5.5  0 │ │ -6.0%
TZA  AL23 │ -1.3  15 -3.4  14 -7.9  14 -10.7  13 -12.9  13 │ -9.8 -9.8 │ -9.9%
SRTY  AL23 │ -1.3  15 -3.4  14 -8.1  14 -10.5  14 -12.8  0 │ -9.9 -9.9 │ -3.1%
TNA#1  AL26 │ +1.0  15 +3.6  15 │ -11.4 -9.3 │
SPY │ +9.9 +9.0 +9.4 +10.9 +11.7 +11.9 │ │
me │ -4.8 -5.2 -5.9 -6.5 -6.7 -6.3 │ │
floor │ -4.8 -7.9 -6.8 -6.8 -8.6 -8.3 │ │

This week I had my fifth and sixth losses in a row!  I am really getting tired of all these losses.  When will the market make up its mind whether it’s going up or down?  Typically, April or May is supposed to be an intermediate top, followed by lower prices for the summer; but this has been true for only four out of the last ten years.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TZA AL 23 10:00 AL 23 13:00 $20.34 $20.16 AL 25 10:00 AL 26 12:11 $18.60 $18.20 -1.3% -1.5%
SRTY AL 23 12:00 AL 23 13:00 $10.05 $10.04 AL 24 11:00 $9.76 $9.74 -0.4% -0.5%
TNA#1 AL 26 12:00 $58.55 $58.51 (Not yet)

SRTY: First trade using the new model was a loser.

The robot trader did not work well this week:
      Monday: Both TZA and SRTY models triggered Monday morning.  Due to a bug introduced last weekend, the robot didn’t actually buy anything, so I bought manually several hours later (and for better prices, as it happened).  I also set the stop-orders manually—but for the wrong prices!
      Tuesday: Automatic stop-update didn’t work, due to a different bug introduced last weekend.  Since it looked like the stop prices shouldn’t actually change today, I didn’t bother rerunning the code after fixing the bug, so once again I didn’t notice that Monday’s stop prices were wrong.
      Wednesday: TZA was supposed to stop out around 9:40am or so, but that didn't happen because I had used 29 hours instead of 15 for Monday’s stop-setting and then Tuesday's update didn't happen.
      Thursday: The TZA stop was at $18.20.  Price got down to to $18.24 at 10:07am; $18.23 at 10:18 and again at 10:49; $18.22 at 11:29 and again at 11:37; finally hit $18.20 at 12:11pm.  Meanwhile, the robot bought TNA at noon, so for 11 minutes I owned two opposing bets that cancelled each other out.
      Friday: Automatic stop-update was successful, but didn't reduce my risk much.  Monday morning’s update is predicted to be a big step up, to -3.1% max loss for TNA.  In the best case, the stop price could be above break-even by next Thursday.

Saturday, 21 April 2012

Week of 2012 AL 20

SPY rose by 0.6% this week, while my account (and loss floor) fell 0.9% to their lowest values ever.

Daily % gain
size
│Max loss│Final Gain
Sym  Buy │ Fri Mon Tue Wed Thu Fri │ Beg   End │
 
TZA  AL04 │ +1.3  29 +0.9  29 -3.8  0 │ │ -0.8%
TNA  AL17 │ -1.0  15 -3.6  14 -5.3  14 -3.7  14 │ -8.2 -8.4 │ -6.0%
SPY │ +9.3 +9.2 +10.8 +10.4 +9.7 +9.9 │ │
me │ -3.9 -3.9 -4.1 -4.5 -4.8 -4.8 │ │
floor │ -3.9 -3.9 -5.2 -5.2 -4.8 -4.8 │ │

TNA: Thursday’s IWM-stop update was “no change”, but there was some wobble in the IWM⇒TNA price conversion, so the max-loss value went down slightly.  Previously I had a TZA stop go up slightly under similar conditions.  This is just something to put with in the current design.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TNA AL 17 11:00 $57.96 $58.15 AL 19 15:00 $54.75 $54.76 -0.8% -0.9%

TNA: Rats!  Fourth loss in a row.  Paid too much on Tuesday, then got very little extra on Thursday, so actual loss ends up 0.1 %-points larger than model.

New rule: When calculating the daily stop, if the lowest price for the last N hours was during the latest hour, then sell immediately rather than raising the stop.  This improves average profit slightly, but more importantly it avoids a potential glitch: suppose the stock is in free-fall, so the current price is the lowest price.  Seconds later the robot tries to set that price as the stop, but the stock has since fallen further and so Schwab rejects the stop-order because it’s already underwater.

Bugfix: The models were not calculating their gains properly.  Basically, they were adding the transaction cost instead of subtracting it.  This is presumably why the last few trades had mismatches between model-profit and actual-profit.  This bugfix reduced apparent profit for 2008…2011 by several percent—but now it’s more realistic.

New trading model

I can haz nu model!  The design target for this model was to catch short downswings like the one that happened last week.  Also, this model avoids real-valued parameters, using moving averages and channels instead.  Because the absolute values of the indicators do not matter, I can use good ol’ MACD instead of PPO.

This is a short-selling model, meaning that I want IWM’s price to go down during the trade.  The “buy” and “sell” actions refer to SRTY, which (like TZA) is a 3× leveraged inverse ETF that tracks the Russell 2000 basket of stocks.

This model has no “buy more” signal.  Only a single tranche is ever purchased.

Buy signal:
  • Time = 10am–3pm, on the hour.
  • This hour’s price is below stop.
  • This hour’s price < SMA( 27 ).
  • Previous hour’s price < SMA( 27 ).
  • MACD( 15, 66, 9 ) < 0.0
  • MACD( 4, 16, 4 ) < its high over the previous 12 hours.
  • MACD( 4, 16, 4 ) > its low  over the previous 12 hours.
  • STDDEV( 7 ) > its EMA( 8 ).
  • I don’t currently own URTY, whose “buy” signal is a strong contrary indicator for SRTY.
  • When buying, lower stop to be no more than 2.7% higher than this hour’s price.
Sell signal:
  • Time = 10am–3pm, on the hour.
  • Either:
    • This hour’s price > SMA( 27 ).
    • MACD( 4, 16, 4 ) > its high over the previous 12 hours.
Stop update:
  • Time = 10am.
  • Calculate new stop = highest price seen in preceding 15 hours.
  • Replace stop with the newly-calculated value, unless I currently own SRTY and the new value is higher than the current one.
  • If the highest price of the last 15 hours was during the last hour, this is a “sell” signal.  Otherwise, if I currently own SRTY, convert this IWM stop to the equivalent SRTY price and update the standing sell-stop order at Schwab.

Below is a chart showing how this model would have behaved over the last four weeeks.  There were three losses and one gain, adding up to -0.1%.  Without the STDDEV requirement, the model would have bought on AL 05 instead of AL 09, for a much bigger gain and overall a profitable month.  But STDDEV is very useful: when volatility is low, most swing trades are losers.  Without it, this model would have a win:loss ratio of 114:189; with STDDEV, it’s 100:116 and the 30% profit over four years is increased to 40%.  But not so hot this month.

Summary of models

Hypothetical Historical Returns
Quarter   TNA TZA URTY SRTY  
qtr
—Total—
yr
2008 Q1 3.2% 0.5% 0.0% 1.7% 5.4% 53.3%
Q2 -2.0% -0.9% 1.1% 0.0% -1.8%  
Q3 2.8% -0.2% 5.4% 2.4% 10.4%
Q4 4.9% 15.5% 3.8% 15.1% 39.3%
2009 Q1 8.6% 4.0% 1.2% 10.3% 24.1% 59.8%
Q2 -1.5% -1.6% 21.6% -1.3% 17.2%  
Q3 7.9% 1.7% -2.0% -0.4% 7.2%
Q4 -0.2% 4.3% 4.5% 2.7% 11.3%
2010 Q1 4.0% -0.8% 0.0% -1.1% 2.1% 45.7%
Q2 -1.9% 8.0% 13.2% 4.0% 23.3%  
Q3 -1.3% 5.4% -0.6% 1.9% 5.4%
Q4 0.2% -1.2% 16.7% -0.8% 14.9%
2011 Q1 0.6% 0.9% -0.5% -1.0% 0.0% 55.4%
Q2 4.8% -1.2% -1.0% 0.2% 2.8%  
Q3 3.9% 24.2% 0.8% 6.5% 35.4%
Q4 2.3% -0.7% 3.1% 1.8% 6.5%
2012 Q1 0.4% -1.7% 12.9% -0.9% 10.7%
Total 36.7% 56.2% 80.2% 41.1% 212.8%

The robot is now using four trading models, identified here by the ticker-symbols they are supposed to trade.  These hypothetical historical returns look great on paper!  I would very much like to be making 45%‒60% per year.

In reality, I did not get the 10.7% profit shown here for 2012 Q1.  Instead, I lost 3.7% because the URTY and SRTY models hadn't been invented yet, the TNA model was improved after the fact, and I made a loser RWM trade that wasn’t justified by any model.

Below is a chart showing weekly results for all models simultaneously.  Of the 221 weeks, there are 84 losses, 41 zeroes, and 96 gains.  Any week with a gain of less than 2.7% is just paying back for the weeks with losses.  About 12% of all weeks have larger gains than that and thus are making actual progress.

Note that 2012 Q1 was a bad quarter with no large gains, except for URTY which I couldn’t actually trade because the model didn't exist yet.


Friday, 13 April 2012

Week of 2012 AL 13

SPY fell by 2.1% this week, while my account fell 0.2% to its lowest value ever.  Just can’t catch a break!  The loss floor rose by 1.1% since I am out of the market again.

Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Thu Mon Tue Wed Thu Fri │ Beg   End │
 
TZA  AL04 │ -0.2  14 +4.7  15 +6.5  30 +2.2  29 -2.6  29 +1.3  29 │ -8.9 -0.7 │ -0.8%
SPY │ +11.4 +10.1 +8.3 +9.3 +10.6 +9.3 │ │
me │ -3.7 -2.9 -1.6 -3.0 -3.9 -3.9 │ │
floor │ -5.0 -4.3 -6.1 -4.4 -3.9 -3.9 │ │

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TZA AL 04 11:00 $18.54 $18.46 AL 12 11:00 AL 12 10:33 $19.31 $19.30 -0.1% -0.2%
AL 10 12:00 $20.49 $20.50

TZA: This was a stop-out, which actually happened at 10:33am but the model didn’t take notice until 11am.  Buy-price for 1st tranche was better than expected, while the 2nd buy-price and the sell-price were almost on the nose, so why the 0.1% difference in expected profit?  This needs investigation.

New rule: Allow TZA trades at 10am; con­tinue prohi­biting TNA trades at 10am because they would hurt performance.  Under this new rule, TZA would have been sold at 10am on AL 12 (because PPO was so high) rather than setting a stop which then triggered 30 minutes later for a 0.1% bigger loss.

This chart makes it look like I have gone too far in the “minimize risk” direction.  For the No 10am case, everything within the range -2.0% to +2.0% is “churn” and adds up to nothing; only the larger gains contribute to profit. Thus, only 6 of 65 trades are worthwhile!  For the With 10am case, 5 of 71 trades are worthwhile.  This is not good enough.  I do not want a 93% chance of “waste of time” each time the robot opens a trade!

Thursday, 5 April 2012

Week of 2012 AL 05

SPY fell by 0.8% this week, while my account was un­changed.  The loss floor dropped by 1.3% to make room for my new trade.

US markets are closed tomorrow for Good Friday.

Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Fri Mon Tue Wed Thu Fri │ Beg   End │
 
TNA  MR26 │ -5.0  13 -1.6  0 │ │ -3.3%
TZA  AL04 │       -1.4  14 -0.2  14   │ -9.2 -8.9 │
SPY │ +12.2 +13.0 +12.6 +11.4 +11.4 │ │
me │ -3.7 -3.7 -3.7 -3.9 -3.7 │ │
floor │ -3.7 -3.7 -3.7 -5.1 -5.0 │ │

TZA: I didn’t have a lot of faith in this trade, but that’s why I use a trading robot.  All I need is faith in the general system; the individual trades are automated.

The daily stop-setting system works!  On Friday it raised my stop on TZA, even though the IWM stop-price didn’t change, due to random fluctuation in the IWM/TZA ratio (which could perhaps have gone 0.3% in the other direction).  Unless something bad happens Monday morning, I expect that the 10am recalc will raise the TZA stop to somewhere in the neighbourhood of -3.6%.

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TZA AL 04 11:00 $18.54 $18.46 (not yet)

TZA: PPO(10,60,12) was rising very slowly Thursday afternoon, until the close when it rose by +0.032.  I require two hours of +0.03 or more in order to trigger a buy-more, so the market needs to rise for at least the first ½ hour Monday morning before plunging or I’ll have to make do with this single tranche.  If the market zooms instead of plunging, the single tranche loss won’t hurt me too much.

TRIX-based trend trades

The trap is set, but has not yet sprung.  TRIX(176,16) peaked at -0.0003 on Tuesday, now it’s back down to -0.0005.  I need +0.00011 to trigger a ”buy”.

This seems to happen over and over: as soon as I put in a recognizer for a price-pattern, that pattern stops happening for weeks or months.  I suspect that this is not a coincidence.  Patterns vary in their obviousness, probably in a way similar to stock prices.  When a pattern becomes so obvious that I notice it and write a recognizer for it, that might indicate that the pattern-obviousness level is approaching a “blow-off top”.  After the blow-off, the pattern recedes for a while and so my recognizer has nothing to recognize.

Surfing the oscillations

In early March, IWM broke its October-November trendline.  It quickly recovered and spent the rest of the month hovering around that line.  Now, in early April, it has broken the new trendline for October-March.  There’s no way to know yet how soon it will recover.  This could be the start of THE BIG ONE, but probably not.

Friday, 30 March 2012

Week of 2012 MR 30

SPY rose by 0.9% this week, while my account fell 1.1% to its lowest value ever.  My loss floor is now equal to my account because I am out of the market.

Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Fri Mon Tue Wed Thu Fri │ Beg   End │
 
TZA  MR22 │ -4.4  14 -10.3 13 -8.3 13 -6.9 13 -5.9  0   │ -6.2 -6.2 │ -8.0%
TNA  MR26 │ +0.6  14 -1.5  13 -3.2  13 -4.1  13 -5.0  13 │ -10.5 -10.5 │ -3.3%
SPY │ +11.3 +12.8 +12.5 +11.9 +11.7 +12.2 │ │
me │ -2.6 -3.1 -3.4 -3.7 -3.7 -3.7 │ │
floor │ -2.9 -4.7 -4.7 -3.7 -3.7 -3.7 │ │

TZA: Gap-down at Monday’s open forced me to take a loss that was larger than my “max loss” number.  This happens less often with index funds than with individual equities, but there is still a chance for it — and more likely now that I am using tighter stops.

TNA: Whiplash!  It’s shit like this, Mr. Market, that drives less-stubborn traders out of the business.  I think the real problem here is that my system assumes a certain time constant for the market’s motions.  When things move faster than that, I get losses.

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TZA MR 22 11:00 $18.64 MR 26 09:30 $17.18 -1.0% -1.1%
TNA MR 26 12:00 MR 26 11:01 $65.73 $65.54 MR 28 11:00 $63.45 $63.49 -0.5% -0.4%

TZA: A “perfect trade” in both timing and pricing — yet still it was a huge loser.  Hopefully the usual rule of ”biggest gains come right after biggest losses” will apply.  Difference between model-profit and actual-profit may be related to the fact that IWM just paid a dividend but TZA didn’t.

Monday: Schwab changed their webpage formatting to be more iPad-friendly, causing my robot to lose its ability to fetch quotes.  Also, the robot’s database contained a rogue price for a real-time quote last Thursday, so it wouldn't have bought at 11am anyway.  Fixed the quote-fetch and manually purchased the TNA shares.  I guess I need to replace the robot’s database of Schwab quotes with stockcharts.com quotes every week to keep things in sync.
Tuesday: Another aspect of Schwab’s website-wide reformatting prevented the robot from updating its stop (whose price didn't change anyway).  Fixed.
Wednesday: Successful 10am stop-update (but no change in price), followed an hour later by a successful PPO-based sale.

TRIX-based trend trades

Current value for TRIX(176,16) is -0.00035.  Getting up to a “buy” level of +0.00011 could happen next week.  I plan to install this software into the trading robot over the weekend.

Quarterly summary

Pretty bad: I lost 3.7% of my money this quarter, while IWM gained 9.8%.

Actual Live model Final model
URTY ×0 (n/a)
RWM ×4 JA 06 - FE 01 -1.0%
TNA ×0 (n/a)
TZA ×2 JA 23 - FE 01 -1.3%
TNA ×1 FE 01 - FE 01 +0.0%
TZA ×2 FE 07 - FE 16 -0.4%
TZA ×2 FE 29 - MR 07 +0.5%
TNA ×4 MR 09 - MR 20 +0.0%
TZA ×1 MR 22 - MR 26 -1.1%
TNA ×1 MR 26 - MR 28 -0.4%
3:5 win:loss TOTAL -3.7%
URTY ×0 (n/a)
RWM ×0 (n/a)
TNA ×0 (n/a)
TZA ×2 JA 23 - FE 01 -1.2%
TNA ×0 (n/a)
TZA ×2 FE 07 - FE 16 -0.4%
TZA ×2 MR 02 - MR 07 +0.3%
TNA ×4 MR 09 - MR 20 +0.4%
TZA ×1 MR 22 - MR 26 -1.0%
TNA ×1 MR 26 - MR 28 -0.5%
2:4 win:loss TOTAL -2.6%
URTY ×3 DE 29 - FE 03 +13.0%
RWM ×0 (n/a)
TNA ×2 JA 10 - JA 13 -0.7%
TZA ×0 (n/a)
TNA ×2 FE 01 - FE 07 +1.0%
TZA ×2 FE 10 - FE 16 -1.1%
TZA ×2 MR 02 - MR 07 +0.4%
TNA ×3 MR 09 - MR 20 +0.8%
TZA ×1 MR 22 - MR 26 -1.1%
TNA ×1 MR 26 - MR 28 -0.5%
4:4 win:loss TOTAL +11.8%

The “actual” column shows what really happened.  The “live model” shows what should have happened, using the versions of the model that were current at those trade times.  The “final model” shows what could have happened, had I spent the entire quarter using the version of the model that I have now.

The “final model” is quite unrealistic.  It asserts that I bought URTY on December 29th, even though I had no URTY trend-trading system until March so I couldn’t possibly have bought it in December.  Without URTY, even the “final” model would have lost -1.2% this quarter (vs. +0.9% for Q4 of 2011).

Conclusion: my swing-trading system has “loser quarters” about ⅓ of the time—this was one of them.  Thankfully, the system very rarely has two loser quarters in a row, so there is reason to hope for gains in Q2.

(By the end of Q2, I hope to have a new graphing system to create these charts, which will produce something less ugly than those stupid rectangles.)

Friday, 23 March 2012

Week of 2012 MR 23

SPY fell by 0.5% this week, while my account fell 1.4% and returned to its lowest value ever.  My loss floor rose by 3.2% thanks to the new stop-setting algorithm.

As discussed last week, I have increased my tranche size to 14% of account.  This is supposed to magnify profits, but as of today it is just magnifying the loss.

Just for fun, the pie chart shown below is for Thursday.  Note the gigantic bet on TNA (which settled Friday morning).  I believe that this is the largest single-ticker bet I have ever placed that didn’t end up as a loss.

Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Fri Mon Tue Wed Thu Fri │ Beg   End │
 
TNA  MR09 │ +2.4  32 +4.0  43 +1.2  42 +1.0  42 -1.8  42 +1.1  0 │ -12.0 -2.4 │ +0.1%
TZA  MR22 │         -1.5  14 -4.4  14 │ -6.2 -6.2 │
SPY │ +11.8 +12.2 +11.9 +11.8 +10.9 +11.3 │ │
me │ -1.2 -0.2 -1.9 -1.9 -2.2 -2.6 │ │
floor │ -6.1 -3.1 -1.9 -1.9 -2.9 -2.9 │ │

TNA: The new stop-setting algorithm did not interfere with the TNA trade, which closed normally due to PPO<-0.2. 

TZA: the new system is risking only 1 percent of my account, so I bought 40% more shares while taking 30% less risk than in the old system!  Problem: after today there is now very little stop-depth remaining and DanEric seems to be expecting that the market will go up a lot on Monday.

me: Briefly got up to -0.2% on Monday, but back down to lowest-ever.  Unless next week is very good for me (= very bad for the bulls), I seem to be heading for a loss this quarter.

floor: On Monday, Tuesday, and Friday at 10am, the new daily stop-update failed to work — for three different reasons! — so I updated the stop manually (except no change on Friday).  On Wednesday and Thursday at 10am, there was no stop to update.  Other robot operations (buy, buy-more, sell) have been observed to work correctly in the new system.
      The new stop system can be further optimized.  It invokes Opera three times: fetch IWM price, fetch TNA price, set new stop.  Each invocation involves a separate Schwab login, which takes several seconds, so the IWM and TNA prices are not for the same moment and their ratio isn’t quite accurate.  Instead, could call Opera only twice: fetch IWM price, then call it again with the new IWM-based stop and have GreaseMonkey re-fetch the latest IWM and TNA prices, calculate their ratio, and set the new TNA stop.

MACD-based swing trades

New rule: If today’s calculated stop price is lower than yesterday’s, and a trade is in progress, then do not lower the stop.  (This fixes a bug when the market gaps down at the open and the model responds by lowering its stop instead of detecting the stop-out.)

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TNA MR 09 11:00 $60.06 $60.11 MR 20 12:00 $61.79 $61.67 +0.4% +0.0%
MR 13 11:00 $60.24 $60.37
MR 15 14:00 $62.04
MR 19 11:00 $63.68 $63.67
TZA MR 22 11:00 $18.64 (Not yet)

TNA:  Argh!  All that risk and only +0.047% reward.  Okay, it wasn’t a loss, but I’m still not happy.  I place the blame on two main factors:
      Bad sale time.  It’s hard to see how the robot could have done any better.  There was no reason to sell at an earlier time.  If my cutoff were PPO<-0.3 instead of PPO<-0.2, the sale would have been postponed all day (because of the rule not to sell when prices are rising) and the next morning’s price would have been about the same.  It’s just unfortunate that so many better times to sell were available, but my model would never have picked any of them.
      Bought too many tranches.  Without the fourth tranche, account-profit would have been +0.4%, almost ten times as much as I got.  New rule: buy at most three tranches of TNA.  See section “Risk analysis” below for justification.

TRIX-based trend trades

Current value for TRIX(176,16) is -0.0005.  Last week it was -0.0009; the week before was -0.0013.  At this rate of increase, a “buy” signal (+0.00011) will probably not happen next week.

Here are the revised rules, with yellow highlighting for changes.  These reduce risk considerably over previous attempts!
Buy if:
  • TRIX(176,16) is now above 0.00011 and had gone below that value sometime after the last sale.
  • TRIX(17,20) is now below -0.028 and had gone above that value sometime after the last sale.
Sell if:
  • TRIX(176,16) is now below 0.0025.
  • TRIX(17,20) is now above 0.033.
Buy more if:
  • TRIX(176,16) is now above 0.00011
  • TRIX(17,20) is now below -0.01 and had gone above 0.003 sometime after the last purchase.
  • Have bought 2 or fewer tranches so far.
Regardless of above, at any time of day, sell immediately if:
  • Price falls below stop.
  • Each day at 10am, recalculate stop to be the lowest price seen in the last 78 hours, but skip this if a trade is in progress and stop is already higher than that value.
  • When buying the first tranche of a trade, raise stop to 0.97 × purchase price if it is less than that.

Risk analysis

In this table, we assume that 100% of my account is divided into the specified number of tranches.  More tranches mean smaller losses on bad trades that end quickly, but also smaller profits on good trades because the later tranches are bought for worse prices.  How many tranches produce the best results?  The “Risk” column indicates the percentage of my account that is at risk (below purchase price but above the stop), averaged over all days 2008-2011 when I owned some of the stock.  The “Ratio” column is gain÷risk, which should be maximized for best performance.

Long - TNA Short - TZA Trend - URTY
TranchesGainRiskRatioGainRiskRatioGainRiskRatio
1 160.9%7.4%21.6 116.7%6.4%18.2 242.3%10.2%23.8
2 109.9%4.9%22.7 126.7%3.5%36.2 208.2%5.3%39.3
3 90.5%3.3%27.8 107.9%2.2%49.0 174.0%4.1%42.4
4 68.2%2.5%27.5 92.4%1.6%57.8 147.4%3.5%42.1
5 54.5%2.0%27.4 75.5%1.3%58.1 125.4%3.1%40.5
6 45.4%1.7%27.3 62.9%1.1%57.2

Based on these results, I have lowered the max-tranche count for TNA to 3, increased it to 5 for TZA (at least for now), and kept it at 3 for URTY.  The risk numbers shown here are not realistic because I am not actually dividing my entire account into 3 or 5 tranches.  Instead, the tranche size is fixed at 14%, which is roughly ⅟7 of my account.  For a 14% tranche with a 15% trailing stop (due to 3× leverage), the maximum account risk is 2.1%.

The values shown above for URTY are based on old TRIX parameters, including a 30% leveraged trailing stop.  With the new parameters — if the model is to be believed — the average risk is actually NEGATIVE, meaning that the stop is above my purchase price on the AVERAGE day when I am holding URTY and so some profit is “guaranteed”.

For TZA, the higher tranche-counts occur very rarely.  The only time during 2008-2011 when five or six tranches would have been bought was during last August’s crash.  Can’t do statistics on a single-event outlier!

Monday, 19 March 2012

Week of 2012 MR 16

SPY rose by 2.2% this week, to its highest weekly close since Octo­ber 2007.  My account rose by 0.9%, back to its value from five weeks ago, but my loss floor fell by 2.5% to what might be its lowest value ever.  This is too much risk for the gain obtained; see “MACD-based Swing Trades” below for the new risk-reduction algorithm, which will raise the loss-floor from -6.1% up to -2.7%.

│Daily % gain
size
│Max loss│Final
Gain
Sym  Buy │ Fri   Mon   Tue   Wed   Thu   Fri │ Beg   End │
 
TZA  FE29 │ -5.8  21 -5.1  0         │ │ +2.5%
TNA  MR09 │ -1.3  10 -1.9  10 +3.9  21 +1.3  21 +3.0  32 +2.4  32 │ -14.4 -12.0 │
SPY │ +9.6 +9.6 +11.6 +11.5 +12.1 +11.8 │ │
me │ -2.1 -2.2 -1.1 -1.7 -1.0 -1.2 │ │
floor │ -3.6 -3.6 -4.6 -4.5 -6.1 -6.1 │ │

TNA: I have just about ⅓ of my money invested in a 3× leveraged fund, so basically I am “100% long the market”.  This is my highest market exposure in quite some time.  I am eking out a profit, but the max-loss floor is just too damn low!  The new system will raise the loss-floor from -12.0% to -2.2%.

I am pleased with my new concern for risk management.  Over the last year, I have been telling people that I am obviously a newbie trader because all I care about is profit, with no thought to spare for risk.  Perhaps I am moving up to Trader Experience Level 2?

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActualMAMA
TNA MR 09 11:00 $60.06 $60.11 (Not yet)
MR 13 11:00 $60.24 $60.37
MR 15 14:00 $62.04

TNA:  So far, so good!  All tranches bought at correct times.  Third tranche bought for exactly-correct price.  Hopefully my trading robot will close this position before the market turns.

New TNA rule: Each day at 10am, find the lowest low and 0.945 times the highest high for IWM over the preceding 22 hours.  Use whichever of these is higher as the new IWM sell-stop price.  If I currently own any TNA shares, take the percentage-change between sell-stop price and current IWM price, multiply by 3, then apply that to the current TNA price to get the new TNA stop price; update the standing “stop” order at Schwab with this new price.

New TZA rule: Each day at 10am, find the highest high and 1.046 times the lowest low for IWM over the preceding 15 hours.  Use whichever of these is lower as the new IWM buy-stop price.  If I currently own any TZA shares, take the percentage-change between buy-stop price and current IWM price, multiply by -3, then apply that to the current TZA price to get the new TZA stop price; update the standing “stop” order at Schwab with this new price.

These new rules replace the old continuous-update trailing stops (TNA: 0.95; TZA: 1.053).  The new system uses hard stops with once-daily updates, which the robot can handle all by itself (trailing stops required manual intervention to get them started).  The number of hours must be one more than a multiple of 7, because Schwab’s pricing data includes only daily highs & lows, not hourly ones.

YearTNA TZA
OldNewOldNew
GainRiskGainRiskGainRiskGainRisk
2008 7.5%1.1% 6.7%1.0% 14.9%0.7% 14.7%0.5%
2009 11.0%1.0% 10.9%1.1% 3.1%0.9% 2.0%1.0%
2010 1.7%1.3% 1.0%1.1% 9.2%0.9% 6.2%0.8%
2011 8.6%1.7% 8.1%0.8% 6.9%0.9% 14.6%0.5%

This table compares the old and new systems.  The “Risk” column shows the percentage of my account that is at risk, averaged over all days when some money was at risk.  Over the last four years, the new TNA system would have produced 7.5% less profit while taking 24% less risk (mostly in the last two years when volatility has been lower); the new TZA system would have produced 12% less profit while taking 33% less risk!

Because the new system takes so much less risk, I can justify increasing the tranche size.  If I increase the tranches from 10%-of-account up to 14%, the new system will produce about 26% more profit while taking the same amount of risk as the old system.  I think I’ll increase the tranche size after the current TNA trade is completed.

TRIX-based trend trades

Still not done yet—my day-job had lots of work this week.  I’ll probably use some variation of the same risk-reduction scheme shown above.  Meanwhile, TRIX(176,15) is still rather negative, so I still have lots of time before a “buy” signal might arise.