Saturday, August 10, 2013

Walk-Forward? More like Crawl Forward


I've been vacationing in Bar Harbor, Maine this week and driving to Quebec today for some sight-seeing. Around the edges I have been cutting my teeth on using the TradeStation Walk-Forward Optimizer on the strategies of which I have recently written. It's a humbling experience, be sure of that, but I like a good challenge - the more impossible, the better.

But for what its worth, I have had some modest success - both in terms of figuring out how it works and getting something to pass the seemingly impossible test.

Here is a graphic of my first conquest using the SPY-1 strategy.



I am finding there is a particular mind set or skill to writing strategies and I seem to have mastered this challenge, at least for the most part. But the skill to 'think' like the walk-forward optimizer, to correctly anticipate what will work, what will fail and know how to get the desired outcome is new to me and will take time to figure out. Lots of time.

I've also been trying to keep an eye on those rascals on Wall Street and made a couple of charts to share with you.

First we'll look at the Gold Miners ETF (GDX) followed by Gold Futures (GC).

The bottom in the gold miners came on Wednesday June 29 (as Fibonacci himself told us) and was confirmed with the gap opening of Monday July 22 which leaped the miners into freedom. It turns out that this important trend line emancipation was successfully retested Tuesday and Wednesday of this past week and the miners should now be ready to rock 'n roll.



Speaking of trend lines, several posts ago in the comment section I noted that gold could well have concluded its daily cycle but the nagging thing was that the price was going to leave the angle of this first daily/intermediate cycle noticeably steeper than the comparable at the 2008 bottom.

I drew a trend line on my chart at home and mused in my comments that gold would have to trade down to about $1250 to reach an equivalent trend line angle. The next chart shows you the trend line I drew in blue and as I was 5 or so days early with thinking gold had bottomed, look where price did bottom.




Yup, right on that trend line I made weeks earlier. Actually, this recent trend line is .1% steeper than the 2008 specimen. Close enough for me.

Symmetry. There is always a way to find symmetry and balance in the way gold price moves - both in terms of price and time. This daily cycle peaked on day 18 of a 28 day cycle - practically nailing the 62.8% measurement in terms of time (days, not price).

We've had a couple of longish daily cycles at 28 and 29 days. Perhaps this current new daily cycle (Monday will be day 3 of the average 24 day duration) will be a shorter cycle and pack a powerful punch, too.

I made it to Quebec - off to find some crepes, coqauvin, croissants and whatever else.

Keep the faith,

John
tsiTrader@gmail.com


Sunday, August 4, 2013

10 New Back Tests: TSI Vector Strategy


In the past day I was able to knock out 10 new back tests using the True Strength Index (TSI) vector strategy. The results are promising and in this post we'll take a look at them in some detail, and also take a peek at their respective equity curves.

I am finding that as I have several ticker symbols that respond well to the strategy it is getting a bit quicker to add new promising candidates. Ultimately I would like to have around 50 of these in play, then do the 'bring me down to reality' process of using the TradeStation Walk-Forward analyzer and, assuming there is anything left to look at, begin posting the trades in real-time and see what happens.

The area in the left side panel of the home page will be used to record the real-time trades. I will replace the existing 'Stock Quotes' gizmo (just below 'Subscribe to my blog') with a list of (hopefully) 50 stocks/strategies. Each stock listed will include the signal indicated for the open market order of the next day's trade. The signal will either be BUY, SELL, HOLD or NO TRADE. Also, each ticker symbol will link to its own separate page with the data I have regarding its back test results and a recording of its performance in real-time. 

I purposely devised the strategy so that it is entirely based on where the stock ends at the close each day. That is, at 4:01 pm est I will know the market order signal for the following morning's NYSE open at 9:30 am est. It will be nothing complicated to use because one either buys, sells or holds at the open each morning. No limit orders, no stop orders, etc. Just market order to BUY or SELL. My strategy is written this way and that is precisely what it back tests.

Let's look now at a graphic that details the 10 new back test candidates. A number of these are mining companies but from here on out I will be expanding more broadly into the stocks that are members of the S&P 500 index.



One of the understandings being brought into clearer focus as I do this back testing stuff has to do with the general topic of risk and pain. Each strategy gives me an opportunity to control both concepts quite well. But the interesting thing is that if one has a decent tolerance for pain, tempered by an accurate understanding of risk, over time that person will, by far, make the most money.

The two S&P 500 ETF (SPY) strategies offer good examples of this observation. Both have extremely high win/loss ratios (88.6% - 86.5%) with modest $Avg Net per Trade ($150 - $160). However, both also have a large losing trade in excess of $1,000. 

As I am able to adjust the value for the stop loss variable, the results shown above have the stop loss for SPY-1 set to 15% and SPY-2 is set to 11%. If I try to avoid the large losing trade in SPY-1 by ratcheting down the stop loss from 15% to 4%, the largest losing trade shrinks from $1,055 to $815. And an even tighter stop of just 2% yields an even smaller largest losing trade of $690.

But the rub is that the 15% stop loss shown above for SPY-1 yields,  over 10 years, a Total Net Profit (including commission expenses - $7 to buy, $7 to sell) of $13,221. The 4% stop loss yields a much smaller Total Net Profit - $8,063. 

By taking less risk with the 4% vs. 15% stop, the largest loser shrunk by $240 ($1055 - $815). But the Total Net Profit yielded when using the 4% stop loss also shrunk - by a whopping $5,158 ($13,221 - $8,063).

My question: is reducing the largest loss by $240 worth giving up $5,158?

If one really cannot take much pain, dropping the stop loss from 15% to 2% brings the worst trade down from a loss of $1055 to $690, but also drops the Total Net Profit to $7,248. This strategy would allow one to sleep better at night, I suppose, but in the end one may consider it expensive sleep - to the tune of $5,973.

Here is a graphic of the first 4 ticker symbols' Equity Curves: AEM, AU, COST and GG


The Costco (COST) and Goldcorp (GG) strategies were a little slow to get in gear - kinda spinning their wheels for the first 8 - 10 trades. The Agnico Eagle Mines (AEM) equity curve is just about textbook perfect.

Here are the next 4: JCP, NCMGY, NEM and SA



On first blush the equity curve of JC Penny looks questionable after trade 20. The data that is not seen is that JC Penny topped at the same time as trade 20 - February 2007 ....... at $87.18. 

Any idea where JCP closed this past Friday? If not, the answer is $14.28. Over the past 6+ years, shares of JCP have lost 83.62%. Meanwhile, the strategy (bless its heart) kept trying to make money and really did not get anywhere, but it did not lose much either. Very little, in fact..... just a few hundred bucks.

And finally for the 2 equity curves of SPY.



If you followed the dialog above about risk tolerance and stop loss settings, you will understand why each strategy exhibited a vicious knife stab or two in their otherwise 'perfect' equity curves.

I hope you have a good week and keep in touch, OK?

John
tsiTrader@gmail.com

Friday, August 2, 2013

TSI Vector Strategy Working in TradeStation Now - Early Results


I am delighted to report that I have finally and successfully written the computer code to run my True Strength Index (TSI) indicator Vector driven strategy on the TradeStation platform. 

If you have a good education in programming this may have been an easy task. But for me, it was the most difficult programming challenge I have undertaken in a long long time. I cannot tell you how many hours I stared at my screen trying to figure out how to write one single line of code for this platform, because my 'now native' Think or Swim platform does things so much differently. It was like learning to walk all over again. I fell down so many times I began to wonder why even bother to get back up. At this point I'm really pleased I did not quit.

Anyway, that's behind me now. Thank heavens. The results I get using the TradeStation platform are the same as the code I wrote for Think or Swim. But the advantage is that TradeStation has an infinitely more powerful capability to test input values.....and even better (which I have not gotten to yet) it has the ability to do blind simulations of the code on the price chart, then optimize, so that eventually one should have a real good idea just how well the strategy is likely to really work in real-time trading.

So far - all of 24 hours - I have tinkered with several ticker symbols using TradeStation and I'd like to give you a look at the results. The outcomes include a $7 buy and $7 sell commission expense.

First we'll look at a chart of 5 ticker symbols which include various measurements of the strategy's effectiveness on past price performance. And second, we'll take a look at the Equity Curves for each ticker symbol.



I want to tell you right up front that while what I am showing you is 100% true, I doubt the 'real-time' performance (which we will begin watching soon) will look this good. The walk-forward testing I have yet to begin will let some air out of the tires and give me a way to know what values to use for the various inputs so they are not overly optimized (read curve-fitted) while offering a statistically sound likelihood of being dependable. 

After I conclude that process then we will begin watching this in real-time and see how it works, OK?

Here are the Equity Curves for each ticker symbol. A little explanation on what to look for is offered in the lower left section of the picture.



Have a great weekend,

John
tsiTrader@gmail.com

Wednesday, July 31, 2013

Gold: A Good Time for Bears to Back Off


I have studied gold's bull market in detail.....for more hours than I hope most good folks have time to spare. The daily and weekly cycles I tediously documented with the assistance of my ability to write ThinkScript code using the Think or Swim platform. If you are interested is seeing the details, here is a post that will show you the details.

Something went awry in December of 2012. The daily and intermediate cycles that worked like clockwork from 2001 suddenly were screwed up. Who gets the credit for this I can only speculate. It doesn't matter though - knowing who and why will not change the past.

But there is one thing about gold's daily cycles that has NOT changed, even once. And that is the fact that each and every gold daily cycle breaks its price trend line before beginning a new daily cycle.

We have not yet broken the current intermediate cycle trend line - but for now anyway, that consistent truth remains in tact, as well.

The point of this post is to alert those interested in gold's price behavior to the fact that the trend line of the current daily cycle begun on June 28 has been broken. If gold's low of earlier this morning turns out to be the end of the daily cycle (Day 23 - which is entirely average for gold's daily cycles) then I think all bears should be warned to get out of our way - because the bull is coming.


The thing I did not draw on this chart is the pennant pattern that gold has formed. Usually, the pennant pattern is a continuation pattern that marks the half way point of an extended rally. If that develops this time (as I strongly suspect will be the case), the move up from $1180 to the center of the pennant at $1325 is $145. This projects price up to at least ($1325 + $145) $1470 and odds are good it will occur in the time frame of just 4 weeks (or slightly less).

If I were a gold bear, I'd really have to think long and hard about doing anything at this point except running.


Tuesday, July 23, 2013

HUI Index and True Strength Index (TSI) Vector Analysis


Fibonacci, that incredibly insightful mathematician of the 13th century who mysteriously whispered his secret to those of us who reverently pondered my previous post of June 30th, has proven (as usual) to have correctly called the exact bottom in the Amex Gold Bugs Index (HUI) quite literally to the exact day (Thursday June 26). 

Confirmation of this fact came yesterday with the gap opening of the HUI index, as price landed squarely on 'the other side' of the 43 week price down trend line and today included more upside follow through, just for good measure. The weekly chart of the HUI index is giving us the requisite Fourth of July show, as the True Strength Index (TSI) indicator has put together first a positive divergence BUY signal, followed by a trend line break BUY signal, and with the TSI (7,4) reading presently just at ZERO, it appears the third bullish BUY signal (ZERO crossover) will be attained, perhaps as soon as tomorrow. 



Now for a look at the HUI daily chart which offers a couple of unusual and bullish thoughts to contemplate.



It's very unusual to see a TSI trend line break BUY signal that takes out 9 months of downward price movement - but that's what we have today. Also, the 'island reversal' pattern on the closeup portion of the chart is now well-defined and easy to visualize. 

Believe me, the items I have identified on both charts have every short running for a sink, preferably with a door they can close behind them. Cover your ears and plug your nose. They had their turn, and now it's OURS!

Right now - TODAY - is the time that those individuals with incredible savvy can put themselves in a position to make, I kid you not, thousands of percent returns over the next few years. If you have not had an opportunity to peruse my article regarding my personal experience with the gold miner's 2008 bear market, I encourage you to give it a look. I think it will help you understand why gains of thousands of percent are available for those who buy ASAP.

For the past 8 or 9 years I have studied the True Strength Index (TSI) indicator quite literally night and day. In more recent years I have written endless variations and extensions of the indicator using my self-taught computer programming skills with the Think or Swim platform. I have back tested the daylights out of my musings and at this point it is very rare that I manage to learn something new, unfortunately.

Lately I seem to have made one of those rare new advances. It involves the use of vectors with the TSI. Rather than continue to hit my head into the bricks trying to draw trend line breaks on the TSI, I got the idea to draw vectors - straight lines that originate at ZERO when the indicator itself crosses from negative to positive. As the slope of these 'vector'  lines could be infinitely variable and easy to back test, I began to wonder if perhaps certain sloped vectors consistently used throughout a stock chart could identify optimal entry and exit points for trades.

Hummmm...... I thought. 

I could not find anything written about the concept on the Internet and surely one can not just try this at StockCharts or FreeStockCharts. Heck, I have probably pondered hundreds of custom indicators - many hundreds - and never seen anything like this...... an indicator that uses vectors to generate buy and sell signals. They may be out there, but I have never seen one, you can be sure of that.

Anyway, I worked on it for a while and got the vector visually working as I imagined. Then I put the TSI with vector indicator to the real test - the back test - to see what it would tell me, if anything. 

And Oh My Gosh! 

I could barely believe my eyes.

Here is a daily chart running the TSI with vector, which is the blue diagonal line, taken from a 10 year back test of the HUI index.




As you can see, this single vector returned $82,205.79 over 10 years of daily trade (LONG only) using 100 shares on each of 59 trades. 15 trades were losers, 44 were winners for a winning percentage of 74.57%. 

If one had bought 100 shares of HUI exactly 10 years ago and sold them today they would have made about $11,000. Need I say more?

My immediate plans are to publish on the website detailed back test results with the corresponding equity curves for a variety of stocks and ETFs. Additionally, I plan to provide a spread sheet that lists each stock/ETF with its current BUY/SELL signal. This published document will be used to record how well this system does going forward in real time. 

So don't be a stranger. Come back once in a while and see how things are going, OK?

For those of you who like looking at charts I ran some quick tests this morning - I did not change the indicator's settings one iota - and will show you what I got. 




Obviously there is a lot of work to be done either optimizing variables or tweaking the strategy so that we end up with something that works well on lots of stocks/ETFs - including from different sectors, not just mining.

Enjoy the rest of your week,

John
tsiTrader@gmail.com

Sunday, June 30, 2013

The HUI Miners Index: Fibonacci Tells of Fortune


I don't know about you, but the Fibonacci mathematical series has always fascinated me. Who would ever have thought that adding 1+1 then 2+1 then 3+2 then 5+3 then 8+5, and so on would generate such a profound explanation of balance and symmetry in nature? I have found so many Fibonacci relationships while studying the price movement of gold over the years that I could not begin to count them all. 

Today I decided to apply my passionate appreciation and respect for Fibonacci by asking him to tell me what is going on with the Gold Bugs Mining Index (HUI). And by golly, he told me! 

Now you have to realize that Fibonacci speaks using words deeply shrouded  in mystery. As long as you understand this you will hear him talk to you. But if you need to have all your i's dotted and t's crossed so that even a 5 year old could understand what is written, don't expect to hear Fibonacci tell his secrets. He gets easily offended as he knows his mathematical series has explained many of the world's most treasured phenomenon (and he knows you have explained none of them).

Teasing aside, I have prepared 11 charts of the HUI to share with you. First we'll look at a weekly chart with nothing on it except "The Trend Line" (blue). Then we will consider 5 charts of HUI measuring price movement in terms of Fibonacci relationships followed by 5 more charts that look at the movement of time in Fibonacci relationships. 

So let's get started with this simple weekly chart dating from 1997 - 2013.



Here is the first chart measuring price movement:



Here we are using the HUI genesis at $35.31 and the 2008 high of $519.68. The 2011 high of $638.59 came in at the 123.6% measurement. The 2008 high at 100% was ever so slightly take out in 2012, as the 2008 low trend line was ever so slightly taken out just days ago. It is very common for large traders to push the crowd just past their nicely drawn trend lines, pick their pockets, then help things get reversed.

This next chart uses the 2002 high (which coincidentally is the 2008 low) as 0% and we measure up to the 2006 high to reach our 100%.



The things that show up on this chart are both interesting and surprising. The 2008 high (nearly) reached the 150% level, as did the 2012 high while the 2011 high (nearly) reached the 200% level. 

The following chart is similar in that it uses the same base point of the 2002 high / 2008 low but for the 100% measurement we travel up to the 2011 all-time high.



The next couple of charts will zoom in on the more recent action and see what is going on. First, this daily chart beginning in early 2011.



If we use the low price reached by HUI last week as our base (0%) and measure up to the all-time high attained in September of 2011 at $638.59 we find that the May 2012 low (which many including myself believe was the beginning of the C-wave save for the weird things that started happening in early December 2012) was a perfect 38.2% of the entire price distance.

And for the final Fibonacci price retracement chart, this uses the same May 2012 low as the basis for 100% and the recent low of last week as 0%.



It kinda goes to show you that even if the Fed, or whoever, manipulates the market, my friend Fibonacci always gets the last word.  :-)

Now let's look at some HUI charts where the Fibonacci relationships of time will be our focus.

Our first chart looks at the origin of the HUI bull and measures time out to the 2008 bottom.



Of particular note is the 38.2% 2003 high, the 50% 2004 high, the (nearly) 138.2% 2011 high and the 150% 2012 high.

Our second time chart considers the 2008 low as 0%, and uses the all-time high of 2011 as the 100% measurement. 



Of particular note here is the 38.2% nails the 2009 high and the 161.8% nails our current low.

I asked Fibonacci if he would mind showing off a little for the onlookers. He said that since they were still paying attention and being reverent he would show off, but just a little. I thanked him graciously and asked what he had in mind. So he told me to try this:



OK. Now that was definitely showing off.

Here is another:



By the way, if you think for one second I am making this stuff up you are dead wrong. I meticulously place these measurements on precisely the ultimate day or price point. What happens after that I get no credit for, believe me.

OK - one last chart:



Well, that's it. I asked Fibonacci if we have seen the bottom in the HUI miners index. I knew he wouldn't tell me flat out, but there was a twinkle in his eye that gave me the answer. There should be a twinkle in your eye, too!

Have a great week,

John
tsiTrader@gmail.com

Thursday, June 27, 2013

Mirror, Mirror on the Wall .... Do Tell Us What Will Happen Next


Today I was tinkering around with some of the hundreds of indicators I have built  using the ThinkorSwim platform, and I came across this one using the Money Flow Index (MFI) as its primary engine. What caught my eye was one of the experiments I coded that plotted the MFI(10) divided by price. 

I have long believed that money flow into a security often precedes or 'foretells' a change in price trend direction. Having done more experiments than I care to admit, this premise is, at best, often absolutely true. But the more typical case is that money flow and price direction are aligned at the hip. That is, price and money flow move like mirror images of one another.

In any case, what I'd like to show you today using 6 charts are curious observations - tending to make the argument that miners are about to rebound skyward and the stock market is nearing failure.

The charts we will look at are weekly chart of the S&P 500 ETF (SPY), the Gold ETF (GLD), the Gold Miners ETF (GDX), then conclude with 3 specific miners - El Dorado Gold Corp (EGO), IAMGOLD Corp (IAG) and Royal Gold Inc (RGLD).

Here is the weekly S&P 500 ETF (SPY):


At present the True Strength Index (TSI) indicator is reading just below ZERO at -6.89. That is bearish, generally. But more interesting is the Money Flow Index indicator (divided by price each bar) which has made a series of lower highs as price has made a series of higher highs. It too has a negative reading of approximately -.05. My hunch is that despite price rising, fewer and fewer investors are believing the rally.....yet the big money is quietly sitting still and not selling - until someone yells FIRE! in the crowded room. Then there will be a massive run to get out and it won't be pretty.

Let's next look at the Gold ETF (GLD). 


It appears to be the case that when Money Flow is headed downwards towards ZERO, then submersed for a while, price is somewhere between flat and corrective. That Money Flow has now worked its way back up to ZERO is favorable for a rally, but no guarantee.

So how about we now look at the Gold Miners ETF (GDX).  



Does the chart look about as you expected? It definitely surprised me. Again, as with my earlier post using the OnBalanceVolume (OBV) indicator, something stealth seems to be going on here in a bullish fashion.

Finally, here are the 3 mining stock charts I promised. Any observation I could make is already on the chart for you to consider.

El Dorado Gold Corporation (EGO):


IAMGOLD Corporation (IAG):


And, Royal Gold Inc (RGLD):