Monday 26 August 2013

Week of 2013 AU 23

IWM rose by 1.8% this week, while my account rose 1.7% to its highest value since MA 31 and nearly up to its value from MR 28.  The loss-floor has fallen to -7.2%.

US market news: On Thursday, the NASDAQ market shut down at 12:21pm due to a quote-storm, which eventually overtook all other markets except ARCA (which apparently was the source of the problem).  Markets reopened at 3:25 EST.  Multiple hours of widespread trading halts seemed to have remarkably little effect on anything — perhaps this market really is completely rigged?

End of week allocations:
% gain
size
Max loss
Sym  Buy  Fri  Mon  Tue  Wed  Thu  Fri Beg   End
 
UWM JL15 -0.3 9 -0.3 9 -0.3 9 -0.3 9 -0.3 0 -0.3 -0.3
AGQ AU09 +2.7 13 +2.7 13 +2.5 12 +2.5 12 +2.6 12 +3.6 13 +1.5 +2.3
ATML AU13 +0.1 10 -0.1 10 -0.1 10 -0.1 10 -0.1 10 -0.1 0 -0.7 -0.7
YHOO AU21 -0.0 10 +0.3 11 +0.3 11 -0.2 -0.2
URTY AU21 -0.1 10 +0.3 11 +0.4 11 -0.5 -1.2
FNSR AU22 +0.0 12 +0.3 12 -1.0 -1.0
IWM +23.2 +22.0 +23.7 +23.0 +24.7 +25.0
me -4.2 -4.4 -4.6 -4.8 -3.9 -2.5
floor -6.1 -5.9 -5.3 -6.7 -7.7 -7.2

AGQ: Continuing to do well!  Max loss is now 2.3% above water, so a profitable end for this trade seems “guaranteed”.

Gold trading

Still have a “Buy” signal!  Still haven’t bought it.

Stock-trading robot

On Wednesday, all stop-updates failed due to some problem at Schwab, which prevented loading of the subpage that shows how many shares I currently hold.  As of Thursday it was working again so I couldn't debug what had happened.

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M  A  M  A 
UWM JL 05 09:30 JL 15 09:30 $63.31 $67.95 AU 19 16:00 AU 19 09:31 $65.98 $65.93 +0.41% -0.31%
AGQ AU 09 09:30 $18.07 (Not yet)
ATML AU 13 09:30 $7.53 AU 20 09:30 $7.47 -0.11%
URTY AU 20 12:00 AU 21 09:30 $61.76 $61.08 (Not yet)
YHOO AU 21 09:30 $27.09 (Not yet)
FNSR AU 22 09:30 $20.62 (Not yet)

UWM: Last of the late-to-the-party trades from JL 15.  Because I was so late, this ended up being a loser instead of a winner.  Oh well.  This trade stopped out; I’m still not sure what number to use for “model sell price” for these leveraged tickers; shown here is the stop-price that had been set (there was some “slippage”).

ATML: Perfectly normal trade.  Everything went as expected.  Unfortunately, it was a loser.

URTY: Robot trade did not go through on Tuesday (Schwab timed out), but I didn't notice until end-of-day, so bought the next morning.  Got a better price, anyway.

Tuesday 20 August 2013

Week of 2013 AU 16

IWM fell by 2.9% this week, while my account rose 2.2%.  The loss-floor has risen to -6.1%, which is higher than last week’s value for my account, so I’ve actually made a profit and taken some of it off the betting table!

End of week allocations:
% gain
size
Max loss
Sym  Buy  Fri  Mon  Tue  Wed  Thu  Fri Beg   End
 
UWM JL15 +0.1  10  +0.2  10  +0.2  10  +0.1  10  -0.2  9  -0.3  9  -0.3 -0.3
YHOO JL25 -0.1  11  +0.2  11  +0.2  11  +0.1  11  +0.0  11  +0.0  11  -0.5 -0.5
FNSR AU08 -0.2  13  -0.2  13  -0.4  12  -0.4  12  -0.4  12  -0.4  12  -1.9 -1.9
AGQ AU09 +0.1  10  +0.9  11  +1.0  11  +1.4  11  +2.5  12  +2.7  13  -0.7 +1.5
URTY AU09 -0.0  11  +0.1  11  +0.1  11  +0.0  11  +0.0  11  +0.0  11  -1.0 -1.0
ATML AU13 +0.3  10  +0.1  10  +0.0  10  +0.1  10  -0.7 -0.7
SRTY AU15 +0.1  11  +0.1  11  -0.3 -0.3
IWM +26.1     +26.7     +26.6     +26.1     +23.7     +23.2    
me -6.4 -5.1 -5.0 -5.1 -4.4 -4.2
floor -10.8 -10.9 -10.7 -8.2 -6.7 -6.1

AGQ: Doing great!  Clearly my best performer so far using the new system.  “Max loss” is now above zero, meaning that some of the profit has already been taken off the betting table.
      The stop price for Tuesday night was too low.  Problem was that the CHANDELIER function uses a Donchian channel, which waits an extra day before recognizing a new peak.  Fixed to use the new peak immediately if it exceeds the Donchian channel.

Gold trading

Still have a “Buy” signal!  But I still haven’t bought it.  Seems less urgent since AGQ is silver so I already have a precious-metals allocation.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M  A  M  A 
UWM JL 05 09:30 JL 15 09:30 $63.31 $67.95 (Not yet)
YHOO JL 25 09:30 $27.73 AU 15 09:30 $27.83 +0.0%
FNSR AU 08 09:30 $22.10 AU 14 09:30 $21.49 -0.30% -0.37%
AGQ AU 09 09:30 $18.07 (Not yet)
URTY AU 09 11:00 $65.63 $65.60 AU 14 14:00 $66.03 $65.87 +0.01%
ATML AU 13 09:30 $7.53 (Not yet)
SRTY AU 15 10:00 $16.51 AU 16 10:00 AU 16 10:33 $16.76 $16.74 +0.25% +0.11%

YHOO: Correct robot operation, but this trade happened not to make any profit.

FNSR: The loss was slightly larger than expected because the trade size was 13% of account instead of 10% (in order to make the trade size be a whole multiple of 100 shares).
      Robot said “sell” Tuesday night, then “adjSx” for Wednesday night even though I didn’t own it any more.  Problem was that the stop-update code uses only the latest day as the test period and the code for handling trades straddling the beginning of test period was interfering with the “retest after 3 days” rule.  Fixed.

URTY: Correct robot operation.  Due to leverage, profit “should have been” larger than expected, but I didn’t get a good sale price so I ended up getting exactly as little profit as the model called for.

SRTY: Robot got confused because IWM gapped below its 220-hour moving average from Wednesday night to Thursday morning.  On Friday morning it thought the position had stopped out, so I sold manually.  Robot needs more work on dealing with what happens when the stop-rĂ©gime suddenly flips like this.

Monday 12 August 2013

Week of 2013 AU 09

IWM fell by 1.4% this week.  My account fell 1.0% to its lowest value ever.  The loss-floor has fallen to -10.8%.

End of week allocations:
% gain
size
Max loss
Sym  Buy  Fri  Mon  Tue  Wed  Thu  Fri Beg   End
 
UWM JL15 +0.4  10  +0.4  10  +0.2  10  +0.1  10  +0.1  10  +0.1  10  -0.4 -0.3
YHOO JL25 -0.1  11  -0.1  11  -0.2  11  -0.2  11  -0.1  11  -0.1  11  -0.6 -0.5
URTY ² JL31 +0.6  21  +0.8  21  +0.1  20  +0.1  20  +0.1  20  +0.1  0  -2.0 -1.9
TNA JL31 +0.1  11  +0.2  11  -0.1  11  -0.1  11  -0.1  11  -0.1  0  -0.5 -0.1
FNSR AU08 -0.0  13  -0.2  13  -1.6 -1.9
AGQ AU09 +0.1  10  -0.7 -0.7
URTY ³ AU09 -0.0  11  -1.0 -1.0
IWM +27.5     +27.9     +26.6     +25.7     +26.1     +26.1    
me -5.4 -5.1 -6.4 -6.5 -6.5 -6.4
floor -9.9 -9.6 -7.3 -7.3 -9.1 -10.8

URTY ², TNA: Two more completed trades using the new trading model.  A profit and a loss that cancelled each other out.

Gold trading

We have a “Buy” signal!  But I haven’t bought yet.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M  A  M  A 
UWM JL 05 09:30 JL 15 09:30 $63.31 $67.95 (Not yet)
YHOO JL 25 09:30 $27.73 (Not yet)
URTY ² JL 31 11:00 JL 31 11:34 $65.97 $65.61 AU 06 11:00 AU 06 11:17 $65.86 $66.09 +0.13% +0.11%
TNA JL 31 15:00 $59.39 $59.40 AU 06 11:00 AU 06 10:30 $59.26 -0.18% -0.06%
SRTY AU 06 11:00 (Skipped) $15.78 AU 06 12:00 +0.04%
FNSR AU 08 09:30 $22.10 (Not yet)
AGQ AU 09 09:30 $18.07 (Not yet)
URTY ³ AU 09 11:00 $65.63 $65.60 (Not yet)

URTY ²: Robot sale didn’t work, because Schwab once again decided to take over 30 seconds to reply to my request for a quote.  Entered manually.  Note that the “Model buy-price” and “Model sell-price” are the top-of-hour prices for URTY, while the “Model profit” is 3× the profit for the top-of-hour prices of IWM.  Usually they are closely coupled; but in this case, because my trades didn’t go through on time and I am often the only person trading URTY at the top of the hour, the model prices are quite far off, while the model profit ended up being mostly accurate.

TNA: Stopped out.

SRTY: Missed this trade because the model uses low-of-last-hour but Schwab provides low-of-day-so-far.  Minimal profit, but still the model needs adjustment to be more realistic.  Should use close-of-last-hour for hourly trades.

FNSR: Jumped after positive earnings surprise Tuesday night.  Hasn’t moved much since.

URTY ³: Robot purchase went through successfuly.  And I bought it back for less than I had sold it for previously!

Friday 2 August 2013

Week of 2013 AU 02

IWM rose by 1.3% this week.  My account rose 0.1%.  The loss-floor has fallen to -9.9%.

End of week allocations:
% gain
size
Max loss
Sym  Buy  Fri  Mon  Tue  Wed  Thu  Fri Beg   End
 
UWM JL15 +0.2  10  +0.0  10  +0.1  10  +0.1  10  +0.3  10  +0.4  10  -0.5 -0.4
URTY ¹ JL15 +0.3  10  +0.1  10  +0.1  10  +0.1  10  +0.1  0  -0.8 -0.8
AGQ JL23 -0.2   9  -0.4  9  -0.5  9  -0.7  9  -0.7  9  -0.7  9  -0.8 -0.7
YHOO JL25 +0.1  11  +0.0  11  +0.1  11  +0.1  11  +0.1  11  -0.1  11  -0.7 -0.6
URTY ² JL31 -0.3  20  +0.5  21  +0.6  21  -2.2 -2.0
TNA JL31 -0.3  10  +0.1  10  +0.1  10  -0.5 -0.5
IWM +26.2     +25.3     +25.4     +25.6     +27.3     +27.5    
me -5.5 -6.1 -6.1 -6.9 -5.4 -5.4
floor -8.5 -7.6 -7.5 -10.0 -10.1 -9.9

URTY ¹: Another completed trade using the new trading model!  Minimal profit, and bought it back two days later for more money, so not the best move.

AGQ: Another completed trade.  Not a huge loss, but it ate up all of this week’s profits from the other tickers.

PPO-based swing trades

Retuned using the new archival data.  Yellow below indicates changes from the table given on 2012 JL 20.

Bull swing (TNA) Bear swing (TZA)
Buy signal:
  • Time = 11am–3pm, on the hour
  • PEAKFREQ(140,8) ≤ 11
  • TRIX(8,2) > 0
  • This hour’s price > 99.9% of previous hour’s price
  • This hour’s price > stop
  • This hour’s price SMA(1)
  • This hour’s price > max of preceding 23 hourly prices
  • PPO(8,73,1) < +1.6
  • PPO(8,73,12) > +0.16
  • PPO(8,73,12) has gone below -0.41 since last sale
  • STDDEV(81) < its EMA(8)
  • Time = 10am–3pm, on the hour
  • PEAKFREQ(140,8) ≤ 10
  • TRIX(24,2) < 0
  • This hour’s price < 100.1% of previous hour’s price
  • This hour’s price < stop
  • This hour’s price SMA(74)
  • This hour’s price < min of preceding 33 hourly prices
  • PPO(10,60,1) > -1.8
  • PPO(10,60,8) < -0.05
  • PPO(10,60,8) has gone above +0.15 since last sale
  • STDDEV(33) < its EMA(4)
Alternate buy signal:
(None)
  • Time = 10am–3pm, on the hour
  • This hour’s price < SMA(74)
  • This hour’s PPO(10,60,8) minus its value from 20 hours ago < -1.55
  • It has been at least 2 hours since last sale.
Buy-more signal:
  • Time = 10am–4pm, on the hour
  • Either
    • PPO(8,73,12) has risen by at least 0.001 during each of the last two hours
    • PPO(8,73,12) has changed by less than ±0.001 during the last hour and rose by at least 0.001 during each of the preceding two hours
  • PPO(8,73,12) fell by at least 0.001 during the two hours before that.
  • STDDEV(81) < its EMA(8)
  • Have bought no more than 1 tranche so far
  • If signal received at 10am or 4pm, postpone purchase to 11am
  • Time = 10am–4pm, on the hour
  • Either
    • PPO(10,60,8) has fallen by at least 0.015 during each of the last two hours
    • PPO(10,60,8) has changed by less than ±0.015 during the last hour and fell  by at least 0.015 during each of the preceding two hours
  • PPO(10,60,8) rose by at least 0.015 during the two hours before that.
  • STDDEV(33) < its EMA(4)
  • Have bought 3 or fewer tranches so far
  • If signal received at 4pm, postpone purchase to 10am 10am or
Sell signal:
  • Time = 11am–3pm, on the hour
  • 99.9%  of this hour’s price < previous hour’s price
  • This hour’s PPO(8,73,12) < -0.41
  • PPO(8,73,12) has gone above +0.16 since original purchase
  • Time = 10am–3pm, on the hour
  • 100.1% of this hour’s price > previous hour’s price
  • This hour’s PPO(10,60,8) > +0.15
  • PPO(10,60,8) has gone below -0.05 since original purchase
Alternate sell signal:
  • Time = 11am–3pm, on the hour
  • This hour’s PPO(8,73,12) minus its value from 20 hours ago < -2.95
  • It has been at least 0 hours since last purchase.
  • Time = 10am–3pm, on the hour
  • This hour’s PPO(10,60,8) minus its value from 20 hours ago > +1.3
  • It has been at least 2 hours since last purchase.
Stop update:
  • Time = 10am
  • Calculate new stop = lowest price seen in preceding 22 hours.
  • Raise new stop to 0% of the highest price seen in preceding 22 hours, if less than that
  • If I don’t currently own TNA, replace stop with the newly-calculated value.  Otherwise:
    • Discard new stop (and keep the old one) if the new value is lower
    • Sell now if lowest price of last 22 hours occurred during the last hour
    • Otherwise, convert the IWM-based stop to the corresponding TNA price and update the standing stop-order at Schwab
  • Time = 10am
  • Calculate new stop = highest price seen in preceding 22 hours.
  • Lower new stop to 105.5% of the lowest price seen in preceding 22 hours, if greater than that
  • If I don’t currently own TZA, replace stop with the newly-calculated value.  Otherwise:
    • Discard new stop (and keep the old one) if the new value is higher
    • Sell now if highest price of last 22 hours occurred during the last hour
    • Otherwise, convert the IWM-based stop to the corresponding TZA price and update the standing stop-order at Schwab

For TNA, some of these revised parameter values cause the corresponding feature to be disabled.  SMA(1) is always equal to the current price, so this clause will never block a purchase.  This hour’s PPO(8,73,12) minus its value from 20 hours ago must be > 99, which disables the alternate-buy rule.  The stop is raised only if it is 0% of the price, which disables the trailing-stop element of the rule.

Below is a comparison of the old and new parameter-sets.  The old parameter-set was tuned on 2008‥2011, while the new one was tuned on 2002‥2011.  The “All” column assumes that I invest 300% of my money in IWM, while the two “TNA” columns assume that I invest 30% of my money in IWM (but actually 10% in TNA), while the “TZA” columns assume that I hold a 30% short position in IWM (but actually I will go 10% long TZA).
   
TNA
 
TZA
All old new old new
2003 135% 1.6% 6.6% -0.2% 0.5%
2004 51% 5.0% 7.0% -1.6% 0.7%
2005 9% 0.7% -1.7% 0.1% 0.2%
2006 51% -1.5% -3.2% -3.2% -1.3%
2007 -6% -1.1% 0.8% -3.6% -0.2%
2008 -114% 10.5% 8.5% 20.5% 24.9%
2009 99% 4.1% 14.9% 2.7% 1.6%
2010 69% 11.6% 9.6% 8.1% 5.6%
2011 18% 8.0% 8.4% 15.3% 13.2%
2012 36% 2.6% -2.0% -3.1% -0.9%
TOTAL 351% 41.9% 52.4% 35.5% 44.7%
Note that both old and new tunings for both tickers show multi-year periods of losess!  The new TNA model would not have done well in either 2005 or 2006, while the new TZA model would have done badly in 2006 and 2007.  Also note that both retuned models show losses for 2012.

Gold trading

Still no “Buy” signal.  Weekly MACD(14,25,9) = -0.01, but I want to see a positive value.  Keep waiting.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M  A  M  A 
UWM JL 05 09:30 JL 15 09:30 $63.31 $67.95 (Not yet)
URTY ¹ JN 25 10:00 JL 15 09:30 $50.02 $63.70 JL 29 13:00 $64.50 $64.55 +2.6% +0.1%
AGQ JL 23 09:30 $18.08 JL 23 16:00 JL 23 10:54 $16.68 -0.79% -0.72%
YHOO JL 25 09:30 $27.73 (Not yet)
URTY ² JL 31 11:00 JL 31 11:34 $65.97 $65.61 (Not yet)
TNA JL 31 15:00 $59.39 $59.40 (Not yet)

URTY ¹: Once again, got very little profit because I was very late to a trade-already-in-progress.  Still, got a profit!

AGQ: Stopped out.  Robot functioned properly, but this trade happened to be a loser.

URTY ²: Robot purchase didn’t work, due to bugs in the debugging code I inserted to try to deal with SRTY trades.  By the time I bought manually, it was ½ hour later and prices had conveniently fallen.  Unfortunately, I bought twice as much as intended because the tranche-size was still set to 20% of account, even though I have started using 10% tranches recently.