Sunday 31 August 2014

Week of 2014 AU 29

IWM rose by 1.1% this week, while my account rose 0.4%.  The loss-floor has fallen to -8.4%.

World news: Politicians can’t seem to decide whether Russia’s actions in Ukraine should be called an ”incursion” or an “invasion”.  Either way, it’s open warfare and the EU is likely to get pulled into it soon.

End of week allocations:

59% equities, 58% cash USD
% gain
size
Max loss
Sym Buy Fri Mon Tue Wed Thu Fri Beg End
YHOO JL22 +1.8 +1.6 16 +1.7 16 +1.8 17 +1.9 17 +2.0 17 +0.2 +0.5
URTY AU25 -0.2 14 +0.2 14 +0.1 14 -0.1 14 +0.1 14 -0.6 -0.6
IWM   +0.1   +0.5   +1.4   +1.2   +0.7   +1.2
me -6.6 -6.9 -6.5 -6.4 -6.6 -6.2
floor -8.1 -8.7 -8.6 -8.4 -8.4 -8.4

YHOO: Continuing to do well!

URTY: Looks like a poorly-timed entry, so it didn’t help my profit any this week.

TRIX-based trading model

Things have not been going well.  I make less than the market when it is going up and lose more than market on downswings.  Why does this keep happening?  It’s easy enough to just “blame the Fed” for why my algorithms perform so well on paper and just keep losing when I bet actual money on them, but that response doesn’t solve anything.  Yes, it’s true that market dips in recent years have been unusually shallow compared to historical norms, because(?) the central bank keeps printing up a shitstorm of money any time it thinks the market might actually go down for a change.  But why can’t my system adjust for that?

During the week of JL 18, ⅓ of my loss came from AGQ, which tracks the price of silver.  A tighter stop would have prevented this, but back-tests indicate that a tighter stop would reduce profit overall.  Silver often has big drops followed by recoveries, but there was no recovery this particular time.  So maybe I just have to live with this.
      Another ¼ of the loss came from two loser URTY trades, which track the broad small-caps market.  The TRIX(q) indicator was wobbling around zero and giving spurious ”buy” signals.  But in order to get quick entries when the market is about to go up, I also have to take quick entries where the market doesn’t go up after all.  This would be okay if there weren't a perfect storm of other losses the same week.

During the period AL 17‥MA 16, I had nothing but losses over and over.  The market was oscillating back and forth and I kept betting it would go one way but then it went the other.  Once again, the biggest culprit seems to have been URTY.  In particular, the TRIX(s) indicator was wobbling around zero and giving spurious “hold” signals for trades that should have been sold.  There *is* something I can do about this: I can bump up the second parameter to TRIX to require a more significant positive value before recognizing a ”hold” signal.  This reduces spurious signals but introduces a delay before a valid signal can be recognized.  How can I tell if the reduction in risk is worth the reduction in profit?

Previously my calculation for ”daily risk” was
      ( max_loss / purchase_price ) - 1
But this says that AGQ was low-risk during JL 18 because the max-loss was above original purchase price; actually it was high-risk because I am charting week-to-week changes and the current price that week was far above my max-loss level.  Another problem: this formula gives negative numbers when things are going well, which makes it hard to figure out how to optimize my parameters, so for goal-seeking I used
      ( total_gain + average_daily_risk ) / total_gain
but I have no idea whether this math actually makes any sense — and I suspect it doesn’t.

I changed my daily-risk formula to (max_loss/current_price)-1, to recognize the high risk of AGQ during JL 18 and avoid negative numbers, so now my ratio-to-optimize is just total_gain/average_daily_risk, although there still seems to be something wrong with the math here.  Let’s see what results we can get for various tickers and periods:

2003‥20112012‥2013JL 11‥JL 18AL 17‥MA 16
URTY old 56.5%/2.08% 16.1%/1.70% -0.6%/1.26% -2.5%/1.56%
new 63.2%/1.81% 14.8%/1.56% -0.5%/0.81% -1.9%/0.92%
ATML old 29.4%/1.39% 3.6%/1.31% -0.4%/0.58% -0.5%/0.40%
new 29.4%/1.39% 3.6%/1.31% -0.4%/0.58% -0.5%/0.40%
FNSR old 49.8%/1.83% 5.7%/1.37% 0.0%/      -0.4%/1.45%
new 22.3%/0.62% 8.0%/0.71% 0.0%/      -0.1%/0.81%

In this table, 2003‥2011 is the back-test period over which the gain/risk ratio was optimized; 2012‥2013 was the forward-test period to see if the system does well with non-training data; in 2014, JL 11‥JL 18 was a problem week of interest, while AL 17‥MA 16 was a problem month.

URTY: I was able to reduce average daily risk while increasing total gain for the back-test period.  Gains are not too bad for the forward-test period, but slightly better for July and moderately better for April/May.  Risk is indeed lower in every case, but I don’t know yet whether that will actually help me feel better about my trading.

ATML: This was the original ticker I used when constructing the TRIX-based trading model.  The new ratio-to-optimize has no effect; there don’t seem to be any parameter values that are better than what I already have.

FNSR: I am no longer trading this ticker because it hasn’t been doing well.  I was able to retune the model to eliminate ⅔ of the risk — by eliminating ½ of the profit!  This improves the gain/risk ratio, so it’s all good, right?  No, that can’t be right.  My ratio-to-optimize thingy is for shit.  But forward-test results are improved, so … should I use the new parameters or not?  I just can’t tell, so this experiment is a failure.

Conclusion: install the new parameters for URTY, but the system still needs work and I don’t know how to proceed.

Parameters for URTY
 oldnew
trixQ27, 228, 2
trixS97, 298, 30
smaQ11
smaS180180
chandelier+312, 11.3312, 11.3
chandelier-28, 9.622, 6.0
trailing-stop0.880.91
retest999, 1.0999, 1.0

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M A M A
FRED JL 11 09:30 (Skipped) $14.96 AU 29 $14.53 -0.41% +0.00%
YHOO JL 22 09:30 $33.48 $33.56 (Not yet)
URTY AU 25 12:00 $87.01 $87.11 (Not yet)

FRED: Fell out of the bottom of its symmetric triangle and hit my stop.  As things turned out, it’s good that I didn’t buy it!

URTY: The new parameters had no effect on the buy-date for this trade; we’ll have to see if there’ll be an effect on the sell-date.

UWM: There were “Buy” signals every day this week, but the limit-prices were never reached.  Try again for next Tuesday.

ATML: “Buy” signal for next Tuesday.

Sunday 24 August 2014

Week of 2014 AU 22

IWM rose by 1.6% this week, while my account rose 0.7%.  The loss-floor has risen to -8.1%.

Shiver, the generic raccoon, will read this paragraph.

End of week allocations:

16% equities, 73% cash USD
% gain
size
Max loss
Sym Buy Fri Mon Tue Wed Thu Fri Beg End
YHOO JL22 +1.1 16 +1.5 16 +1.7 16 +1.6 16 +1.6 16 +1.8 16 -0.3 +0.2
TNA AU11 -0.1 22 +0.8 22 +0.1 22 +0.8 22 +0.3 22 +0.3 22 -0.8 +0.3
URTY AU18 +0.0 14 +0.1 14 -0.0 14 -0.3 14 -0.3 14 -0.3 -0.2
IWM   -1.5   -0.1   +0.3   -0.1   +0.0   +0.1
me -7.3 -6.0 -5.5 -6.0 -6.7 -6.6
floor -9.4 -9.4 -9.3 -9.3 -8.2 -8.1

YHOO: Doing well after a month!

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M A M A
FRED JL 11 09:30 (Skipped) $14.96 (Not yet)
YHOO JL 22 09:30 $33.48 $33.56 (Not yet)
TNA AU 11 11:00 $70.93 $70.92 AU 21 11:00 10:06 $72.00 $72.01 +0.34% +0.30%
AU 13 11:00 $70.50 $70.63
URTY AU 18 11:00 $84.44 $84.49 AU 21 11:00 10:03 $83.17 $83.06 -0.28% -0.26%

FRED: Now 26 days inside the range of prices seen on JL 17.  Still looks like a symmetric triangle.  But it doesn’t really matter what the fuck this stock does because I’ve already decided not to buy it for this go-round.

TNA: Disappointing.  Only 0.3% gain in ten days.  Stop-out.

URTY: After last Friday’s pre-emptive sale, this re-entry had low risk.  However, it managed to lose 0.3% in four days, cancelling out the gain from TNA.  Slippage on the stop-out caused me to lose the entire initial risk.  I just like obsessing over these minor technical details to avoid looking at the big picture of the unending horror that is my life as a stock trader.

ATML: Buy-signals for Wednesday, Thursday, and Friday; none of the orders reached their limit prices.  No signal for next Monday.

UWM: Monday AU 18’s buy-order did not reach limit.  No buy for Wednesday because SMA(q) < CHANDELIER(+).  There is a buy signal for next Monday, but even if it reaches limit I’ll probably lose money because nothing ever goes my way on the stock market.

Monday 18 August 2014

Week of 2014 AU 15

IWM rose by 1.0% this week, while my account rose 0.9%.  The loss-floor has risen to -9.4%.

End of week allocations:

82% equities, 51% cash USD
% gain
size
Max loss
Sym Buy Fri Mon Tue Wed Thu Fri Beg End
YHOO JL22 +0.9 16 +0.9 16 +0.8 16 +1.0 16 +1.1 16 +1.1 16 -0.3 -0.3
URTY AU05 +0.1 14 +0.5 15 +0.2 15 +0.5 15 +0.5 15 +0.9 15 -1.8 -0.9
TNA AU11 -0.1 11 -0.3 11 -0.1 22 +0.0 22 -0.1 22 -0.8 -0.8
SRTY AU15 -0.0 11 -0.8 -0.8
IWM   -2.5   -1.6   -2.2   -1.5   -1.3   -1.5
me -8.2 -8.0 -8.5 -7.8 -7.5 -7.3
floor -11.3 -11.4 -10.9 -11.7 -10.5 -9.4

URTY: Sold at open, which turned out to be the high of the day!.

MACD-based trading model

Finally fixed that bug where the robot would sell an hour after buying, if the high of the last two days was today (before purchase).  New rule: Do not pre-emptively sell SRTY when IWM makes a double-top, if this is the first day of holding the ticker.  This rule is needed because Schwab does not provide lows and highs for the last hour, but instead offers lows and highs for the day-so-far, so I can’t tell if it’s a ”new high” since buying SRTY or is just the same ”old high” being repeated all day.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M A M A
FRED JL 11 09:30 (Skipped) $14.96 (Not yet)
YHOO JL 22 09:30 $33.48 $33.56 (Not yet)
URTY AU 05 12:00 $78.28 $78.18 AU 15 09:30 $83.53 +0.87% +0.86%
TNA AU 11 11:00 $70.93 $70.92 (Not yet)
AU 13 11:00 $70.50 $70.63
SRTY AU 15 13:00 $40.43 AU 15 15:00 AU 15 14:00 $39.91 $40.49 -0.15% -0.02%

FRED: Now 21 days inside the range of prices seen on JL 17.  Looks like it’s making a symmetric triangle.

URTY: Yet another case of pre-emptive sale because price closed over SMA(s) but below CHANDELIER(+) so there was no valid stop-price.

SRTY: Robot sold an hour after purchase due to bug.  Should have sold after two hours due to IWM price exceeding SMA(150).  As it turned out, the early sale was advantageous.

UWM: Buy signal for Friday, but it wasn’t valid because SMA(q) is below CHANDELIER(-) for UWM, although not for IWM which is what the robot looks at.  There is a valid buy-signal for Monday.

Saturday 9 August 2014

Week of 2014 AU 08

IWM rose by 1.4% this week, while my account rose 0.3%. The loss-floor has fallen to -11.3%.

Thursday political news: NATO says Russian invasion of Ukraine is imminent.  Canada announces that it will send “helmets and vests” to Ukraine to help them repel the Russians.  The US announces air-strikes in Iraq.  Multiple nations in West Africa declare states of emergency due to the ongoing Ebola epidemic.

Sunday financial news: For the first time ever, the ISDA has ruled that Argentina has actually defaulted and the sellers of CDS must pay up.  Meanwhilem, Portugal says it will nationalize Banco Espirito Santo for €3 billion.  Equity shareholders and subordinated-debt holders will be wiped out, but it is unclear whether CDS on the bank will actually pay off or will transfer to the successor Novo Banco entity. Depositors are being told they’ll get all their money back.

End of week allocations:

58% equities, 59% cash USD
% gain
size
Max loss
Sym Buy Fri Mon Tue Wed Thu Fri Beg End
YHOO JL22 +0.8 16 +1.2 16 +0.8 16 +0.9 16 +0.8 16 +0.9 16 +0.0 -0.3
URTY AU05 -0.2 14 -0.1 14 -0.3 14 +0.1 14 -1.5 -1.8
IWM   -3.9   -3.0   -3.3   -3.0   -3.4   -2.5
me -8.5 -8.1 -8.6 -8.5 -8.7 -8.2
floor -9.3 -9.6 -10.7 -11.4 -11.0 -11.3

YHOO: Went nowhere this week.  Price oscillated around SMA(s), causing the max-loss to bounce back and forth between +0.0 and -0.4.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M A M A
FRED JL 11 09:30 (Skipped) $14.96 (Not yet)
YHOO JL 22 09:30 $33.48 $33.56 (Not yet)
URTY AU 05 12:00 $78.28 $78.18 (Not yet)

FRED: The last 16 days have all been inside the range of prices seen on JL 17.  Looks like I should have bought it.

Saturday 2 August 2014

Week of 2014 AU 01

IWM fell by 2.6% this week, while my account fell 0.7%. The loss-floor has risen to -9.3%, which is about the same as where it was back in September, November, December, May, and also July.  Come on, Mr. Market — hurry up and crash already!

Political news: It seems Israel is actively trying to create the impression that it is committing war crimes in Gaza.  Perhaps this will help the Likud party retain control of the Knesset in the next election, which of course is the only thing in the world that actually matters?

Financial news: On Wednesday night, because US courts sided with US vulture funds and blocked debt-service payments to anyone else, Argentina was forced to default on its national debt (again).  Meanwhile, Banco Espirito Santo declared a loss that was larger than its shareholder equity (and thus is now bankrupt); apparently the government of Portugal is not planning to bail it out, so now what?  Globally, stocks fell sharply Thursday and fell some more on Friday.  Bounce next week?

End of week allocations:

16% equities, 73% cash USD
% gain
size
Max loss
Sym Buy Fri Mon Tue Wed Thu Fri Beg End
YHOO JL22 +1.0 16 +0.9 16 +0.8 16 +1.2 16 +0.9 16 +0.8 16 -0.4 +0.0
SRTY ¹ JL25 -0.0 11 +0.0 11 +0.0 11 +0.0 11 +0.0 0 -0.6 -0.4
URTY JL30 +0.0 14 -0.8 14 -0.8 14 -1.1 -1.4
SRTY ² JL31 +0.1 11 +0.3 11 -0.7 -0.2
IWM   -1.3   -1.8   -1.6   -1.2   -3.4   -3.9
me -7.8 -7.9 -8.0 -7.6 -8.6 -8.5
floor -9.7 -9.1 -8.9 -10.5 -10.6 -9.3

YHOO: Went below SMA(s) on Friday, causing a sudden jump in stop-price.

Stock-trading robot

Ticker
Symbol
Buy dateBuy priceSell dateSell priceAcct Profit
ModelActualMAModelActual M A M A
FRED JL 11 09:30 (Skipped) $14.96 (Not yet)
YHOO JL 22 09:30 $33.48 $33.56 (Not yet)
SRTY ¹ JL 25 12:00 $39.84 $39.83 JL 28 14:00 $40.11 +0.04% +0.03%
URTY JL 30 13:00 $82.00 $82.18 JL 31 11:00 $77.65 $77.75 -0.75%
SRTY ² JL 31 13:00 $41.79 AU 01 15:00 $43.17 $43.20 +0.31% +0.30%

FRED: Has now spent 11 days inside the range of prices seen on JL 17.  Bottomed on Tuesday, then retraced 38% of its fall from the 17th.  Going back down again?

YHOO: TRIX(s) is now rising but still near zero.  I suppose it could sell next week.

URTY: Nasty loss, but I think the robot did the right thing.  Although it is purely indicator-based and does not read the news, the robot ended up making an “FOMC play” (go long just before the announcement).  Unfortunately, the market was disappointed in Yellen’s remarks (no new QE to counteract Argentina and Banco Espirito Santo).