Sunday, 26 February 2012

Week of 2012 FE 24

SPY rose by 0.4% this week, while my account and loss floor were un­changed because I was out of the market all week.

US markets were closed on Monday for Presidents’ Day.

Daily % gain
size
Max % lossResults
Symb  Buy Fri   Mon   Tue   Wed   Thu   Fri Beg   End
 
TZA  FE07 -2.1  21 -0.1  21 +2.1  0 −1.8%
SPY +8.7 +8.7 +8.4 +8.9 +9.1
me -2.6 -2.6 -2.6 -2.6 -2.6
floor -2.6 -2.6 -2.6 -2.6 -2.6

MACD-based swing trades

There were no swing trades this week.

Results from old parameters
YearTNATZA
200810:25-5.7%14:20+5.0%
200919:17+5.2%11:25-5.2%
201011:10+9.7%7:9-2.4%
201118:7+10.3%13:11+30.0%

Archival data: Last July, when I began to use hourly IWM prices for trading, the stockcharts.com website offered only one year of historical data, so I had only back to June ’10 which was about 2,600 hourly data-points.  Recently, stockcharts.com have started to offer ten years of hourly data!  That’s about 17,000 data-points.  So I downloaded and converted their charts (back to January ’08) into my arrays of numbers, to see how well my trading parameters would have done in prior years.  Results were awful!  The parameter-values that worked so well in 2011 were ineffective in prior years: a 40% gain for 2011, but 7% in 2010, 0% in 2009, and -0.7% in 2008.  The win:loss ratios were also bad.  It looks like I tuned things too closely for the way things went in 2011, which was not typical of market behaviour in other years.

Results from new parameters
Year TNA TZA
2008 9:10+9.3%: +2.3%, -1.3%, +2.1%, +6.1% 8:9+14.2%: +1.2%, +1.6%, -3.3%, +14.7%
2009 7:7+11.1%: +6.2%, -1.3%, +6.2%, +0.0% 6:7+2.9%: +1.7%, -1.6%, +0.7%, +2.2%
2010 8:5+1.7%: +2.9%, -1.2%, -0.2%, +0.2% 9:3+9.3%: +3.2%, +4.7%, +2.7%, -1.3%
2011 7:9+8.1%: +3.7%, +4.3%, -1.6%, +1.7% 8:11+18.6%: +0.5%, -0.7%, +20.0%, -1.3%

Above is the new tuning, whose main claim to fame is that it makes a profit in each year on both tickers.  But the win:loss ratio is still bad in over half of the cases.  In 2010, the overall profit would have been 11%, while in 2011 it would have been almost 27%.  (In reality, I lost money in 2011 because I didn’t use this system.)

Also shown above are profits for individual quarters: the TNA system lost money for consecutive quarters (Q2 and Q3 of 2010), but those were both good quarters for TZA.  Combining TNA and TZA, 11 of the 16 quarters were profitable.  No quarter lost more than 3% and there were two quarters with 20% gains.  Over four years, this system would have earned 75% profit, while SPY lost 6% during the period!  If this thing works, I can double my tranche-size for even more profits — to make 150% over four years.

Here are the new swing-trading rules:  The parts highlighted in yellow describe new program code.
LongShort
General:
  • Use IWM’s price-chart for calculations, but buy TNA for leverage.
  • Indicator-params: use PPO( 8, 71, 12 ) and SMA( 15 ).
  • Use IWM’s price-chart for calculations, but buy TZA for inverse leverage.
  • Indicator-params: use PPO( 10, 60, 12 ) and SMA( 75 ).
Buy if:
  • PPO_histogram > 0.4
  • PPO_signal < 1.8
  • Price > SMA.
  • Price has risen from an hour ago.
  • Price is higher than at any of the preceding 33 hours.
  • PPO_histogram has been below -0.2 since the last time the Alternative-sell rule was used.
  • PPO_histogram < -0.1
  • PPO_signal > -2.6
  • Price < SMA.
  • Price has fallen from an hour ago.
  • Price is lower than at any of the preceding 34 hours.
  • PPO_histogram has been above 0.27 since the last time the Alternative-sell rule was used.
Alternatively, buy if:
  • PPO_histogram has risen by at least 2.9 over the last 33 hours.
  • At least 5 hours have passed since the last time there was a buy or sell.
  • PPO_histogram has fallen by at least 4.1 over the last 22 hours.
  • At least 10 hours have passed since the last time there was a buy or sell.
Buy more if:
  • PPO_histogram rises by at least 0.02 for each of two hours, then falls by at least 0.02 for two more hours.  A “no-change” hour may occur between the rising hours and the falling ones.
  • Have bought 3 or fewer tranches so far.
  • PPO_histogram falls by at least 0.03 for each of two hours, then rises by at least 0.03 for two more hours.  A “no-change” hour may occur between the falling hours and the rising ones.
  • Have bought 3 or fewer tranches so far.
Sell if:
  • PPO_histogram < -0.2
  • Price has fallen during the last hour.
  • PPO_histogram has been above 0.4 since the last time the Alternative-buy rule was used.
  • PPO_histogram > 0.27
  • Price has risen during the last hour.
  • PPO_histogram has been below -0.1 since the last time the Alternative-buy rule was used.
Alternatively, sell if:
  • PPO_histogram has fallen by at least 2.7 over the last 33 hours.
  • At least 5 hours have passed since the last time there was a buy or sell.
  • PPO_histogram has risen by at least 0.6 over the last 22 hours.
  • At least 10 hours have passed since the last time there was a buy or sell.
Regardless of above, at any time of day, sell immediately if:
  • Price falls to 95% of highest seen so far.
  • Price rises to 105.3% of lowest seen so far.

Here is a chart showing how the above rules interact with the last four years of data:

(The underlying price-data’s colour changes from grey to brown halfway through the chart due to my workaround for bugs in the stockcharts.com program.)

Note the long straight sections with no trades (April 2009, July 2009, March/April 2010, October/November 2010, November 2011).  Also note some short straight sections that have only loser trades (April 2008, Setember 2008, November 2009, December 2011).  This swing-trading system requires volatility!  It doesn’t make any money when the market is being boring and just going up day after day.  I need another system for detecting low-volatility periods and profiting from them.  Perhaps I will use TRIX for that, and have it trade URTY and SRTY instead of TNA and TZA.

Friday, 17 February 2012

Week of 2012 FE 17

SPY rose by 1.6% this week, to its highest value since 2007, while my account fell by 1.4% to its lowest value ever.  My loss floor rose by 2.1% because I am now out of the market again.

Euro news: The ECB exchanged its Greek bonds for mostly-identical ones that are now immune to any “Collective Action Clause”.  Then the Parliament of Greece introduced a bill to cram-down the Greek bonds, forcing everyone to accept 50¢ on the €, except for the ECB which is now immune so Greek retirees lose half their money while central bankers lose nothing.

Daily % gain
size
Max % lossResults
Symb  Buy Fri   Mon   Tue   Wed   Thu   Fri Beg   End
 
TZA  FE07 +4.1  22 -0.1  21 +1.2  21 +3.8  21 -2.2  21 -2.1  21 −11.0 −11.0 −1.8%
SPY +7.1 +7.9 +7.7 +7.2 +8.4 +8.7
me -1.2 -2.2 -1.9 -1.3 -2.6 -2.6
floor -4.7 -4.7 -4.7 -4.7 -2.6 -2.6

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceProfit
ModelActualMAModelActualMAMA
TZA FE 07 15:00 $18.69 $18.67 FE 16 13:00 FE 16 14:00 $18.48 $18.41 −1.6% −1.8%
FE 09 11:00 FE 09 12:17 $18.79 $18.75

Rats!  Another loss!  On Thursday at 1pm, the model (based on stockcharts.com’s graphs) said “sell” but my trading robot (based on real-time quotes from Schwab) said “wait” because the quote it got for IWM at 1pm happened to have fallen by one penny from the quote at 12pm, so I got a reprieve because the model says not to sell when the last hour’s price-change is favourable.  No such luck at 2pm, though.

The trading robot seems to be functioning properly and is ready to make money as soon as market conditions are favourable—which wasn’t this week.  For IWM, the PPO-signal is now +0.54 while the histogram is -0.002, so the robot is primed to buy back TZA if the market drops sharply next week, or to sit calmly idle if it doesn’t drop.

Saturday, 11 February 2012

Week of 2012 FE 10

SPY fell by 0.1% this week, while my account rose by 1.0%.  To get this 1.0% gain, I had to lower my loss floor by 2.5%.

Euro news: The prime minister of Greece did not resign as threatened, but six (so far) of his cabinet ministers *have* resigned and one of his coalition partners (LAOS) has apparently left the coalition.  There is rioting in the streets of Athens and Thessaloniki.  On Sunday, the Greek Parliament is supposed to vote in favour of the bailout, but many politicans believe that a vote for the bailout would be career suicide.  Germany continues to insist that they will pull the financial plug if the Greeks don’t agree to the latest demands.  Increasing numbers of people are getting sick of this charade and wishing that The Powers That Be would stop pretending that Greece didn’t actually default two years ago.

Daily % gain
size
Max % lossResults
Symb  Buy Fri   Mon   Tue   Wed   Thu   Fri Beg   End
 
RWM  JA06 -8.6  17 -8.3  0 −5.1%
TZA#0  JA23 -17.2  12 -16.3  0 −9.0%
TNA  FE01 +9.0  17 +7.7  0 +0.5%
TZA#1  FE07 -0.7  10 -1.3  10 -0.1  21 +4.1  22 −15.2 −11.0
SPY +7.2 +7.1 +7.4 +7.7 +7.9 +7.1
me -2.2 -2.2 -2.2 -2.3 -2.2 -1.2
floor -2.2 -2.2 -3.9 -3.7 -5.2 -4.7

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceProfit
ModelActualMAModelActualMAMA
TZA#1 FE 07 15:00 $18.69 $18.67 (not yet)        
FE 09 11:00 FE 09 12:17 $18.79 $18.75

On Tuesday, as the 3pm hour approached, it was clear that there would be a “buy” signal for TZA, so I logged into Schwab Active Trader and waited.  As the seconds ticked by during the 15:00 minute, I received popup messages telling me that “I” had placed an order to buy TZA, that “my” order had executed successfully, and that “I” had placed a hard-stop order for $15.87.  I immediately deleted the hard-stop and replaced it with a 15% trailing stop, which initialized itself at exactly $15.87.  My robot had worked perfectly!

On Thursday at 11am, there was a “buy more” signal, but the robot didn’t do anything because my ISP had picked that day to screw around.  There were lengthy periods all day when ping got no reply from the server, or ping worked but ssh couldn’t log in, or I could log in but programs wouldn’t run because their execution environments were screwed up.  It seems that my ISP is trying to push me off the El Cheapo hosting that I already paid for up through September!  I thought again about buying a wall-wart plug computer and running the server in my house.  By the end of the day, the ISP had restored normal operations, so I still haven’t bought my own server for $165 (plus import duties).  Anyway, I bought the shares manually, 77 minutes later than the model but for slightly less money.

Surfing the oscillations

Everything always takes longer than expected!  Here is an hourly chart for IWM since the last cycle-low.  The beige line is supposed to be the “daily-cycle trendline” which remains unbroken after 52 days (usually there is a trendline-break every 35‒40 days).  The blue line connects the October and November lows; I think this is the “intermediate-cycle trend” which Toby Connor predicts will be broken soon (actually, he predicted that a week ago but it still hasn’t happened).

Note that FE03 through FE09 form an ”island top”. Last year, I found island tops were quite effective in predicting when the market would turn, but Thomas Bulkowski says that it is the *least* reliable pattern he knows!

Also note that IWM broke through its upper trendline around FE02 and has been in a ”bubble” ever since.  Some people say that the usual result after a bubble is that the stock will return to the price it had when the bubble started, which is now below the beige line.

Saturday, 4 February 2012

Week of 2012 FE 03

SPY rose by 2.2% this week, to its highest weekly close since July, while my account fell by 0.7% to its lowest weekly close ever.  The loss floor is now the same as my account balance because I am out of the market.

Euro news: The prime minister of Greece has announced that he will resign on Monday if a deal to avoid defaulting on his nation’s debts can’t be worked out over the weekend.  It seems Germany has decided that it is time for Greece to default, so there will be no deal.  It takes six weeks to do a “voluntary restructuring”, so if there is no deal this weekend then Greece will not be able to make the March 20th interest payment on its bonds.

US news: Friday’s unemployment report seemed like good news: unemployment fell to 8.3%!  The market loved it!  But one of the reasons why the unemployment number fell is that about 700,000 people gave up looking for work, so they no longer count (even though they’re still hurting).  Next week there will probably be a reaction low as traders realize that Friday’s report wasn’t quite as good as it first seemed.

This week’s pie chart includes a new black segment labelled <out>.  This is money that I have withdrawn from the account for living expenses.  The black segment will remain for the remainder of the year to prevent my account value from seeming to drop suddenly.  Withdrawn money is not a “loss”!

Daily % gain
size
Max % lossResults
Symb  Buy Fri   Mon   Tue   Wed   Thu   Fri Beg   End
 
RWM  JA06 -4.7  17 -4.1  17 -3.9  17 -5.9  18 -6.6  17 -8.6  17 −5.1 −5.1 −5.1%
TZA  JA23 -6.9 9 -3.7  12 -3.6  12 -9.7  12 -11.3  12 -17.2  12 −12.8 −12.1 −9.0%
TNA  FE01 +0.6  10 +2.0  10 +9.0  10 −15.1 −14.1 +0.5%
SPY +5.0 +4.7 +4.6 +5.6 +5.7 +7.2
me -1.5 -1.3 -1.2 -2.2 -2.2 -2.2
floor -2.2 -2.7 -2.7 -2.2 -2.2 -2.2

MACD-based swing trades

Ticker
Symbol
Buy dateBuy priceSell dateSell priceProfit
ModelActualMAModelActualMAMA
TZA JA 23 13:00 JA 23 13:26 $22.46 ⑽ $22.31 ⑽ FE 01 12:00 FE 01 12:12 $20.21 $20.16 -8.2% -9.0%
JA 30 11:00 $21.41 ⑽ $21.37 ⑶
TNA (Do not buy) FE 01 12:13   $57.81   FE 01 14:02   $58.21 +0.0% +0.5%

On Monday at 11am there was a “buy more” signal for TZA.  My trading robot finally bought something!  It bought within the same minute as the model called for, so “model buy-date” and “actual buy-date” are the same.  The buy-prices are different because TZA fell during that minute, from $21.41 at 11:00:00am to $21.37 at 11:00:20am when my order went through.

Problem: my robot bought the wrong number of shares!  The model called for 10% of my account to be invested, but the robot bought only 3%.  I fixed this bug, but decided not to manually buy the missing shares because I already had lots of RWM.  That turned out to be a good move because this TZA-swing was a loser (and RWM stopped out the same day).  The “actual profit” value looks worse because I bought fewer of the second tranche lower-priced shares, but my total dollar loss is less than what the model called for.

On Wednesday at 12pm there was a “sell” signal, but the robot didn’t sell due to yet another programming bug.  I fixed the bug and manually sold the shares.  Because the market jumped so much on Wednesday, I assumed that the model would call for buying TNA so I bought it manually—forgetting that I had recently changed the rules so TNA is not bought when PPO-signal is very high, as it was then.  So I reconceptualized TNA as a day-trade.  This turned out to be the wrong move because TNA had a nice pair of days after I sold it.  Oh well.

With the current parameters, the TZA swing-trading model has now had five losses in a row.  The last gain was NO 02.  Before that there had been four more losses, after a big gain on SE 23.  So really it’s been four bad months of almost continuous losses on TZA.  I can hardly wait for the market to turn.

Surfing the oscillations

Here is SPY for the last year.  Note the “Santa Rally” in the latter part of December, extending into February, just like this year.  Note how there is usually a downswing just after exceeding a previous high, and the market has just exceeded its high from last July.  Note how last July’s high was preceded by an “enthusiasm gap”, just like this latest high.  Note how last July’s high was followed by a week-long downswing, followed by a week of retrace, followed by several weeks of crash.  Note that the 200-day moving average is now at pretty much the same level as it was last July.

If past is prologue, then the market has now topped; it will swing down until FE 10, then swing back up FE 17, then head down towards a spike-low around MR 02.  However, MR 02 is too early; the market needs to drop around 17%-20% by MR 13 in order for Dr. Bernanke at the Fed to have a reasonable-seeming excuse to start printing US dollars like there’s no tomorrow, which he needs to do this summer in order to assure Obama’s re-election in November.  So something doesn’t *quite* add up here with these dates.

DanEric can barely contain himself, but he avoids calling a top because he got burned on that last month (as did many others, last month and in January 2011 as well).  Presumably, Lucas Papademos will resign as Greek P.M. on Monday, which will be taken as an excuse for a big gap-down (just like last July, when a Greek default was perceived as “imminent”).

I will wait for MACD to tell me when to short the market.