Option FanaticOptions, stock, futures, and system trading, backtesting, money management, and much more!

Does Any Technical Analysis Work? (Part 4)

One can do an internet search on “does technical analysis work” and find lots of discussion on the topic.

JA wrote:

     > …I know if someone discovers a profitable strategy he won’t share
     > it… I was asking about “public and very common strategies using
     > TA,” like RSI, Fibonacci etc, because if they work, why aren’t a
     > lot of bots out there making money really easy with that? And my
     > comment about people selling courses is because it confuses me
     > when I see people I trust telling me they use those techniques
     > with good results. How is that possible? Do you think they work?

CF responded:

     > ok dude. you know the “public and very common strategies like
     > RSI, Fibonacci etc.” Those are absolutely total trash. Like: a joke,
     > just a total joke. It’s quite confusing to me that you seem to be
     > saying “many people think those work…” If you ask 1000 working
     > daytraders… they will just smile. Those things are equivalent to
     > the “lose weight!” systems you see sold on informercials you know?
     >
     > With regard to people telling you they use those techniques with
     > good results, those people are: liars. Even if it’s your brother
     > or something, non-working traders often get really confused, sort
     > of exaggerating their own trade results for the better! [7]

Not to be lost on the humor (remember back to [6]! The internet parlance “ROFL” comes to mind right now) is this claim that the standard indicators commonly discussed as the basics of TA do not work.

AJ writes:

     > …any developer can program a bot to trade using TA… and there
     > are a lot of bots out there, and none of them are working. I did
     > a lot of backtesting myself using multiple strategies and none
     > of them work long term… do you really think there is some bot
     > out there that can make a good profit through automated trading
     > and is actually being sold?? Yeah sure, so I coded a bot to make
     > millions when I’m sleeping and I’m publishing it as open source
     > or selling it for $500. Just name ONE that makes guaranteed
     > profit. [8]

He absolutely may be right about this!

On another note, I’m not at all convinced that he knows “none of them are working.” I’m not convinced he’s ever purchased/leased a single bot to try for himself. I’m not convinced he has had real conversation with [credible] others who have. He may be one to spend lots of time in the forums and read what others (also potentially with limited experience like himself) have to say. Back from [7], does anybody know 1,000 working daytraders?” Lots of people say lots of things. We have to evaluate the source, too, and assess what we really don’t (and what they can’t) know.

Again, AJ makes some really good points to consider. As mentioned in the fifth paragraph here, I’ve just started testing multiple strategies over the long term. None have really worked thus far.

To be continued next time.

Does Any Technical Analysis Work? (Part 3)

Today I want to continue discussing some other internet opinions I’ve found about whether TA can actually work.

     > There are a lot of people giving signals to buy or sell based on some
     > indicator or price pattern. There are a lot of people selling courses
     > about how to make profit trading using these well known strategies.
     > And I don’t mean a really… [obscure and esoteric genius strategy]…
     > I mean all these Fib retracements, RSI, MA, etc. I can’t understand why
     > those strategies exist. They are public and they are easy to implement
     > with a bot, so they cannot work right?
     >
     > No you’re not missing anything, if it worked it wouldn’t be on sale.
     > But that’s not a wholesale indictment of TA. [5]

Lots and lots of empty claims exist out there with very little supporting data. All this is to say we need to generate the data ourselves. We need to test everything else run the risk of being duped by something that sounds good and is marketed well.

A “bot,” by the way, is a computer executing algorithmic trading code.

On one forum, I saw someone repeat my observation given in the second paragraph of the above-linked post. Here is another’s response to that:

     > You must be joking man, there are a lot of people selling books on
     > how to lose weight! Good grief! [6]

Made me laugh!

Not only is this a great analogy, though, I suspect it may be true. Judging by how many diets have crossed the screens and shelves over the years, how many can really be said to work? Different diets work for different people here and there, but most diets probably have a low success rate overall. The same is probably true for TA because emotionless systems are very hard to maintain through times of famine and decline. Unless someone has done thorough trading system development, fear will probably own the day forcing said trader to sit alone on the sidelines licking psychological wounds from locked-in losses.

I will continue next time.

Does Any Technical Analysis Work? (Part 2)

The initial impressions of trading system development discussed last time begs the question about whether technical analysis (TA) is all hoax.

I did an internet search for “do simple technical indicators work” and found some interesting posts.* Here is the first:

     > There is no blanket strategy of “TA.” No TA gospel definitively says
     > buy/sell when the price crosses the 200-MA. You’re simply looking for some
     > pricing pattern that appears in the chart to influence your decision to buy
     > or sell, but there are literally an infinite number of pricing patterns.
     > Maybe it’s not a 200-MA but a ratio of 200 * (1 minus the index
     > increase over that period). People come up with all sorts of weird
     > algorithms; some people even find one that will work for a bit. Ultimately,
     > it could be anything… [it qualifies as TA] as long as it involves the
     > quoted price relative to some historical metric… [emphasis mine] [1]

This argues certain combinations of TA indicators can be developed into profitable trading strategies. Yay!

This also provides some hope for data mining, which is an approach I will discuss in future posts.

Here’s another take that is similar in nature:

     > You seem to think “TA…” is some fixed, specific thing… there are a
     > hundred different ideas on so-called “TA” and every person who trades
     > argues bitterly about different aspects of charting… everyone who
     > uses one form of charting assumes that every other charting technique
     > is completely stupid. [emphasis mine] [2]

Mention of “hundred” different TA ideas is deceptively small since the actual amount is infinite (see [1] above).

Unfortunately, people posting online engage in name calling, flaming, and trolling. I often see an oozing excess of pride, arrogance, and ego. In the world of statistics and valid trading system development where strategies either pass or fail, I see no reason to get emotional or to passionately defend things. Follow the data and start testing where the data ends.

Out of those commenting online about TA and trading, I wonder what percentage actually has supporting data? Nobody is credible without large sample sizes under their belt and that includes number of strategies tested.

My algorithmic trading journey has just begun with 300 strategies tested. Even were I to have tested 10x that, though:

     > …just because YOU haven’t found one that you think works well enough
     > to rely on… [doesn’t] mean… [others have]. And when people do, they don’t
     > divulge it. If someone had a strategy that worked, it would not be on sale. [3]

Similarly:

     > When people figure something out and it’s vital to their own profitability,
     > they don’t run around sharing it. Why don’t people understand this? It
     > would save a lot of heartaches… [4]

This is a very interesting concept to consider. In other words, don’t expect anything you see, hear, or read to actually work.

Gotta love the smear campaign, too. You can’t say online financial forums lack entertainment!

I’ll continue next time.

* — Online content may or may not be credible. You have to decide for yourself, and this applies to my blog as well.

Does Any Technical Analysis Work? (Part 1)

I went over my second critique of technical analysis (TA) here. My third criticism is that finding a viable TA-based strategy is extremely difficult.

As discussed in this second paragraph, my goal with trading system development is to find viable strategies: not necessarily profitable ones. I will go into more detail about what makes for a viable trading strategy in future posts.

As discussed in the second paragraph here, in order to test strategies I need objective, codable guidelines. Many, but not all, TA-based strategies are this way.

I borrow from Kevin Davey’s approach and define a strategy as a particular code and/or particular time frame and/or particular market. If I take three different codes, for example, and test them on five different markets and two different time frames, then I have studied 3 * 5 * 2 = 30 different strategies.

I have tested nearly 300 strategies on three different markets. I would guess this to be a lot relative to the average trader because most people don’t learn to code, learn to test, or learn to develop strategies. As I discussed in the linked post from the first paragraph, most traders don’t show or provide any data.

Nevertheless, 300 strategies just barely qualifies me as a newbie when it comes to algorithmic trading. I’m not talking about the options work I have been doing for the last several years. I’m talking about my work on futures markets. Thus far, I’ve tested strategies on US equities, on gold, and on crude oil. What has taken me months would take a seasoned quant days (hours?). I am still learning how to code, still finding strategies, and still trying to figure out how I plan to organize all this.

My initial impression thus far is that finding viable trading strategies is really, really difficult.

Many things about the financial industry and trading domain do not surprise me. I’m not surprised by the fraudulent claims. I’m not surprised by the statistical manipulation. The whole debate about whether successful traders actually exist implies not only that something works but also that someone has discovered it. I’ve questioned whether a better way exists somewhere.

In discussing all these topics, I’ve been talking around the issue of viability.

With regard to viability itself, what does surprise me is to fail time after time after time—nearly 300 in all—at my attempt to find it. I have not found any strategies that meet all my criteria. I have not found any strategies that have compelled me to start trading them straight away.

I will continue this discussion next time.

Curve Fitting 101 (Part 4)

Before I move forward with trading system development approaches, I want to give one more example of how to curve fit: increasing strategy complexity.

Here’s a basic strategy (in EasyLanguage):

          Input: len(14), //optimize 2-20 by 3
                    offset(40), //optimize 30-45 by 5
                    pt(500); //optimize 500-2000 by 500

          setprofittarget(pt);

          if percentR(len) < (50 - offset) then sellshort next bar at market;
          if percentR(len) > (50 + offset) then buy next bar at market;

This is a trend-following strategy that will go long (short) when Williams %R is above (below) an extreme value. I am testing extreme %R values of 20 (80), 15 (85), 10 (90), and 5 (95):

Initial_WFO_equity_curve_(4-20-20)

Notice how the strategy performed exceedingly well until the arrow (~500 days in). After that, equity took a precipitous fall and lingered in the doldrums for the remainder of the backtest.

I can improve this by increasing strategy complexity. At the arrow, I will flip from trend following to mean reversion:

          if percentR(len) < (50 - offset) then buy next bar at market;
          if percentR(len) > (50 + offset) then sellshort next bar at market;

After adding a rule, I can look at the equity curve again. Where I see the beginning of another large drawdown, I will add a subsequent rule to flip back to trend following. I can then look at the equity curve again. Where I see the beginning of another large drawdown, I will add a subsequent rule to flip to mean reversion. Rinse and repeat a few times!

With first four lines of code unchanged, here’s what I ended up with:

          If date <= ELDate(11,01,2011) then begin
               if percentR(len) < (50 - offset) then sellshort next bar at market;
               if percentR(len) > (50 + offset) then buy next bar at market;
          end;

          If date > ELDate(11,01,2011) and date < ELDate(08,14,2012) then begin
               if percentR(len) < (50 - offset) then buy next bar at market;
               if percentR(len) > (50 + offset) then sellshort next bar at market;
          end;

          If date >= ELDate(08,14,2012) and date < ELDate(02,20,2013) then begin
               if percentR(len) < (50 - offset) then sellshort next bar at market;
               if percentR(len) > (50 + offset) then buy next bar at market;
          end;

          If date >= ELDate(02,20,2013) and date < ELDate(02,11,2014) then begin
               if percentR(len) < (50 - offset) then buy next bar at market;
               if percentR(len) > (50 + offset) then sellshort next bar at market;
          end;

          If date >= ELDate(02,11,2014) and date < ELDate(12,03,2015) then begin
               if percentR(len) < (50 - offset) then sellshort next bar at market;
               if percentR(len) > (50 + offset) then buy next bar at market;
          end;

          If date >= ELDate(12,03,2015) and date < ELDate(09,29,2016) then begin
               if percentR(len) < (50 - offset) then buy next bar at market;
               if percentR(len) > (50 + offset) then sellshort next bar at market;
          end;

          If date >= ELDate(09,29,2016) and date < ELDate(01,24,2018) then begin
               if percentR(len) < (50 - offset) then sellshort next bar at market;
               if percentR(len) > (50 + offset) then buy next bar at market;
          end;

          If date >= ELDate(01,24,2018) then begin
               if percentR(len) < (50 - offset) then buy next bar at market;
               if percentR(len) > (50 + offset) then sellshort next bar at market;
          end;

I increased the number of rules in this strategy from one to eight. The rules couple date ranges with a mean-reversion/trend-following switch.

This is some of the most blatant curve-fitting possible. I’ve used nothing but hindsight, which we know is invalid as a system development technique (see fourth paragraph). Also, recall in Part 2 where I chose a specific parameter value (VIX < 35)? With that approach, I still have to settle for whatever equity curve results. Here, every rule I add directly manipulates the equity curve in whatever direction I so choose.

This is also the epitome of curve fitting because the rules refer to historical date ranges that don’t even exist in the future. Doing so is criminal indeed:

Curve-fit WFO equity curve (4-20-20)

This has 78% winners on 479 trades, a profit factor of 1.71, and trades nearly even with regard to long and short positions (with short trade profit factor of 1.55). Slippage and commissions are included.

The more complicated the strategy, the more beautiful the equity curves. Just remember the more beautiful the equity curve, the less likely it is to be fit to signal rather than noise.

Today’s result is totally, utterly, and absolutely curve-fit. Can’t trade that, folks: no way, no how.

Curve Fitting 101 (Part 3)

Last time, I discussed how specific trade rules may result in curve fitting.

One way to avoid this is to use optimization to explore the surrounding parameter space. When applied as discussed in Part 1, optimization is a bad word. Testing all variable combinations in this manner, however, can be useful as I discussed in paragraphs 4-5 here. Borrowing from this post, look at the following visual:

Spiky Optimization (6-14-16)

This is a three-dimensional plot with performance (net return) on the z-axis. An optimization may pick the highlighted (red arrow) peak as the best, but if it’s surrounded by losers then the results are probably more fluke (lucky) than due to signal being identified. I would feel much more confident trading a strategy in the middle of a high plateau region where I can choose variables knowing if I am a little off to either side, then I may still have a good chance for good future performance.

Do not use optimization only to choose the best; use optimization as a tool to explore the surrounding parameter space. Test all combinations and survey the landscape. Spikes are bad and high plateau regions are good. The objective is to assess the probability that good performance is not just a matter of random chance.

A standard optimization tests all variable combinations, which are called iterations. Looking back at the plot above, the iterations are ordered pairs along the xy-plane. The total iterations to be tested in a standard (exhaustive) optimization is the product of the number of values each variable can take. The Part 1 strategy had nine iterations: 20 – 100 by 10. Suppose I wanted to add an m-day exit and test exits between 3 – 21 days by an increment of three. Now I have a total of 9 * 7 = 63 iterations to test. If I also add a momentum rule and optimize momentum lookback from 10 – 30 by four, for example, then I have a total of 9 * 7 * 6 = 378 iterations. You can see how fast the iterations add up (especially if I increment by one or two instead of five or 10). This can dramatically impact computer (or especially manual: UGH!) processing time.

Going back to the Part 2 example, if I wanted to incorporate a VIX filter, then I should test different values rather than looking at just 35 (e.g. 20-50 by increments of three) to survey the surrounding parameter space.

Next time, I will discuss one final curve-fitting method.

Curve Fitting 101 (Part 2)

In the last post, I gave examples of how optimization could be used to manufacturer an investment newsletter scam. Today, I want to get back to trading system development and give another example of how curve fitting can generate deceptive results.

Also known as overfitting, curve fitting is tailoring a trading strategy to better match historical noise than persistent signal. The strategy may look great in backtesting, but it is unlikely to look good when applied to future data because noise is random.

Besides optimization (see Part 1), a second way to curve fit is to use specific parameter values. Consider a simple strategy that buys pullbacks (in TradeStation’s EasyLanguage):

          If C = lowest(C,10) then buy next bar at market;
          If barssinceentry >= 3 then sell next bar at market;

This strategy buys after the lowest close in 10 days (bars) and sells after the position has been open for at least three days.

Suppose this strategy suffered its maximum drawdown on the VIX spike over 35 in the 2008-9 financial crisis. Let’s add another rule by changing the first line to:

           If C = lowest(C,10) and close of data2 < 35 then buy next bar at market;

Now, the long entry will occur when close is the lowest close in 10 days and when VIX is less than 35. This can improve the equity curve by avoiding a losing trade(s) and going flat in an area that previously experienced drawdown.

The problem here is adding a specific rule to fix a particular past occurrence. It’s like applying a single Band-Aid. A similar event capable of causing significant damage may occur in the future, but the filter may not be effective since we based it on a sample size of 1. Look what happened in February 2018:

Curve fit chart (4-18-20)

The arrows point to February 2 when ES had a big drop of 2.3% and VIX spiked to 17.31. That was a big move with VIX closing at its highest level in nearly 15 months (11/8/16), but it did not trigger our filter (17.31 < 35). The curve-fit strategy would enter the pullback just in time for February 5, 2018, when the market fell 5.4% and VIX spiked to 37.32. The VIX filter would now be active: one bar too late to serve its purpose. I analyzed a trading strategy that applied this rule here. My curve-fitting comments are in the seventh paragraph.

I will continue the discussion next time.

Investment Newsletter Scam

For some reason, this curve-fitting exercise reminds me of the investment newsletter scam.

This scam may be executed in two different ways, and either is good reason to avoid investment newsletters. Technically speaking, I don’t believe they are illegal. “Scam” is an informal term whereas “fraud” is a crime. Both are deceptive, however, and would be categorized as optionScam.com.

Imagine the following hypothetical scenario.

I can probably sell lots of subscriptions to my investment newsletter by heavily promoting the winners and making the losers disappear. What if I were actually to publish many investment newsletters over the next few years? Suppose I publish under different pseudonyms and offer them online for free. I don’t market or advertise, but anyone can access them. They’re located by internet search engines with verifiable time/date stamps. This is a legitimate service.

Out of 10 newsletters, nine underperform and one significantly beats the overall market. I go all-in and market the one:

      > OPTIONFANATIC NEWSLETTER BEAT THE MARKET BY 10% OVER THE
      > LAST THREE YEARS!!! ONLY 100 SUBSCRIPTIONS WILL BE OFFERED
      > FOR $59/MONTH OR $649 FOR THE FULL YEAR! ACT NOW!!!

This was Just. Random. Luck. One out of 10 did well and the others sucked! Although future subscribers are unlikely to profit based on these odds, I have the documented performance to support my prior success (I simply neglected to mention the losers). What an ingenious way to eliminate performance stress and accountability. It’s a lucrative and innovative proposition.

For all we know, this may be a popular tactic. Often when I see an enticing sales pitch, I conduct an internet search for the name + “scam.” As an example, for the hypothetical “RocketOne Trading,” I would search “RocketOne Trading scam.” I have seen lots of reviews on forums or websites from people who have been outsmarted by nefarious entities. I’ve also seen many shill [fictional] recommendations. Check out the second paragraph here. It’s not infrequent to see [sketchy?] companies go out of business and newsletters fold, but new ones are always popping up. Some of these get called out by online mentions (e.g. “X newsletter is actually being Y person who was slapped with a prior SEC complaint”). Indeed, many of these may be orchestrated by a few key players.

This investment newsletter scam could be perpetrated another way. Imagine I send out stock recommendations to 2,000 random people: 1,000 each receive buy or sell recommendations. A few months later, I follow-up with a second stock recommendation to the happy half: 500 each receive buy or sell recommendations. A few months later, I follow-up with a third stock recommendation to the very happy half: 250 each receive buy or sell recommendations. After 21 months and roughly 4,000 mailings, 15 ecstatic people will have received seven consecutive profitable stock recommendations:

      > EXCLUSIVE OFFER FOR OPTIONFANATIC NEWSLETTER SUBSCRIBERS:
      > ONE NEWSLETTER PER MONTH FOR ONE YEAR: ONLY $4,999! GET
      > IN BEFORE THE DOORS SLAM SHUT!!

How likely are the 15 to believe I am the stock whisperer and to subscribe at a moment’s notice?!

Including the curve-fitting exercise from my last post, these are all forms of optimization. I have probed everything, selected, and marketed the best [without breaking the law]. Admittedly, I haven’t told the whole truth, and my actual probability of being right next time is only 50/50 (at best). Nonetheless, from the other side the prospects sure must look amazing!