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 lossFinal
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!

No comments:

Post a Comment