Technical Analysis — What It Can And What It Can’t do (Finance Shorties Series #3)

harry_can
9 min readSep 27, 2022

--

No trading success with technical analysis? If you want to know what you’re missing, kindly read on…

It’s getting a bit nerdy today, would be happy if you stick to the article nonetheless. Our friend Hulrum from the realm of dwarves surely would have!

If you are groping in the dark while using technical analysis / chart analysis for trading, maybe with questions just as these:

  • Which indicator should I use?
  • Which indicator settings should I use?
  • Do indicators make any sense at all?
  • Are indicators enough for decision making?

… this article is just right for you.

Disclaimer: the following content is for informational purposes only and does not constitute financial advice. Do not take any decisions based solely on my writing.

What is technical analysis?

Here is a somewhat dry but surely accurate definition from Investopedia.

“Technical analysis is a trading discipline employed to evaluate investments and identify trading opportunities by analyzing statistical trends gathered from trading activity, such as price movement and volume.” Investopedia

And here is my turn on it: We financial dwarves or humans are trying to do something with a chart. This is usually the price chart. We try to get some information whether we should buy, sell, or do nothing at all.

So let’s have a look at this:

Candlestick chart with distribution similar to real-world data — how will it go on?

How does this chart behave in the future? How do we/Can we even find out? — What we’re doing is up to us, for example:

  • Take the chart as it is and just think about it (“Oh, this part here looks like a triangle! That must mean the stock goes up soon.”).
  • Do some rather simple maths and statistics stuff on it and set some criteria. (Such as indicators: “If the simple moving average over 40 days is higher than the 160 days moving average, it’s maybe a good time to buy.”)
  • Create crazy machine learning feature matrices from several indicators and other stuff. Then see whether we can predict the future. There are great ideas on that out there.

Depending on how systematic our approach is, we are rather discretionary or quantitative.

A purely discretionary trading dwarf or human trusts his/her guts. Just relying on experience it is hard, if not impossible, to quantify his/her actions. He or she might never know why something has worked or hasn’t — and takes large risks. This is especially true if position size and stop-loss are set arbitrarily. Thinking “this is a great opportunity because I am feeling like it” might lead to large position sizes and large stop loss distances. It is not easy to check whether the approach would have worked in the past or could work in artificially generated future scenarios.

A quantitative approach, on the other hand, is usually fully deterministic and reproducable. It is clear what happens if conditions X, Y, and Z are met or not met. Stop-loss distances and position size are dependent on current price variations (standard deviations etc.) or similar. It is possible for everyone to check if something worked in the past or under certain scenarios. At least as long he or she is willing to put in the effort to reproduce the approach. (If you need someone to do such things for you, the worldly author is happy to!)

Simplified explanation of quantitative vs discretionary for relaxed dwarves

What measures do we take in everyday life if we want to see if something works or not? We experiment. Does this plant need more or less water? Does the soup need more or less salt? A purely quantitative approach is like documenting everything that was done (amount of water or salt), and its outcome (dying or living plants, facial expression of your pitiful or enviable guests at the table). This, in turn, allows us to do it again if successful and to assess whether something similar might work or not.

A discretionary approach is more like watering the plants a bit, speaking to them from time to time depending on how you or Hulrum feel, at the same time changing lots of things (say, the light in the room, the temperature etc.) simultaneously. Then afterwards one tries to figure out why something bad happened. Or, in case of success, one is over-confident, yet does not know what might happen under uncertain future circumstances. Some dwarves might even think that speaking to the plants was most essential…

Let’s see what the author of a great recent trading book said on this topic. This article is inspired by this book and not only dwarf Hulrum highly recommends it:

Kioseff: What matters is proof

“It does not matter what technical indicator is applied, or how common its application is. What matters is proof. Proof that the method in which the indicator is used works. Adhering to the traditional interpretation of a popular indicator can work so long as there is data to substantiate it.”

— Brandon Kioseff in his book “Simple Techniques That Beat the Market: A Practical Guide to Beating the Market Using Technical Analysis”

That is, to assess whether technical analysis (TA) is “good” or not, we first need something clear and precise to discuss: A certain set of rules which can then be tested. That demystifies the process.

  • How will our dwarves use TA? Which indicator(s), under what circumstances, measured in what way, on which time scale?
  • What is considered “good” or “bad”? What is the criterion for success?

The goal of this article

This article is meant to give dwarves and humans a feeling: How are the chances of being “right” with one’s trading approach? Whether this approach is completely loose and chaotic or strictly systematic, whether it is developed during three days or ten years does not matter.

Kindly scroll down to last section if you’re not interested in detailed methodology and just want to trade (summary is below the last figure).

Explanation & building blocks of the strategy

For this article merely the long part (“upwards only”) of a simple Relative Strength Index (RSI) / Candlestick Bullish Engulfing strategy from Kioseff’s book was re-implemented using backtrader. The idea of using merely the long part is to present something a beginner trader would maybe do, without shorting any securities. Thus, dwarves and humans can learn something about viability of such trading strategies that, at first, seem very reasonable.

RSI is a very commonly used indicator. A value larger than 70 in common understanding — not necessarily true — should indicate overbought situations. That means, price is bound to decrease “soon”. Smaller than 30 is seen to signal oversold conditions (bound to increase “soon”). It is seen to work well in ranges (“sideways” up-and-down movements) as opposed to trending prices (i.e., some favorite up or down direction with occasional “bumps”).

Bullish Engulfing patterns are a simple candlestick pattern in charts. Put shortly, a downward candlestick is followed by an upward candlestick — and the upward candlestick’s “real” body (open to close) fully “engulfs”, so overlaps, the downward candlestick’s body. See two simple examples below.

Left: Bullish engulfing, full green body (“open-close”, thick rectangle) fully overlaps the previous full red body. Right: the opposite. The worldly author does not believe too much in such things… but finds it worth studying nonetheless!

The strategy was tested on data of a large real-world stock market index. This is not trading advice, so the index name is not disclosed. The time window was 01/2015 to 09/2022.

The strategy rules from Kioseff’s book are:

  • Enter long if RSI (close) < 70 (“no entry before downside mean reversion”) and
  • A Bullish Engulfing Pattern is formed (in this backtest according to the TA-Lib’s definition)

Positions are exited (stocks sold) if:

  • 4 % profit achieved or
  • 4 % loss suffered or
  • RSI > 70 (“take profit in anticipation of mean reversion”)

YAAAWWWWN

Yes, I hear (not only) my beloved dwarf Hulrum yawn heartwarmingly already. But the best is yet to come.

A very conventional setting for RSI is a period of 14 days, so let’s take that as base case. Moreover, the 4 % setting as stated above for both take-profit and stop-loss was used. Let’s see if this works well.

Butow can we know what a “good” result is? Hulrum sometimes gets greedy and thus, a lot of profit is good. But maybe that is not the only thing.

System Quality Number (SQN) as a quality measure for trading

What if we have 10 losses of 100 dollars in a row and then a single 1,500 $ profit within 10 years? This results in a profit of 500 $, but what a pain going through ten losses in a row. Moreover, such a strategy behavior results in trading just over once a year (11 trades in 10 years). That now is awfully boring and unproductive for the average dwarf.

There is a measurement number called “system quality number” (SQN). Briefly, it tells us if a strategy (1) is profitable, (2) has reasonable variance between its gains and losses and (3) has a sufficient number of trades over time. If you are a curious dwarf, please read this informative website on it. Otherwise, just believe the wordly author.

If SQN is positive (> 0), that’s good, as it means the strategy was profitable in backtest overall. 1–2 is average, 3–5 excellent, and so on, and if you see a SQN > 7, either you overfitted heavily or can go straight to the Bahamas.

The SQN result for the strategy above turns out to be…

— drumroll —

… erm, -1.33. Yes, minus.

So, are technical indicators useless maths exercises? Let’s not jump to conclusions. What if we allow some variation within the indicator and other strategy parameters?

In this example, RSI period is varied between 7 and 21 days (±7 days of 14) and the take profit / stop loss are varied symmetrically (e. g. tp = 2 %, sl = -2% and so on) between 0 and 10 %. Let’s see what happens to our SQN.

We are able to find a find a SQN much better than -1.33: The best one in our study is -0.21 (period 11 days, take-profit and stop-loss: 8 %). That is still negative, however and might have issues such as overfitting.

Overall, SQN gets better with larger take-profit/stop-loss. But these “slow” strategies also behave more like buy-and-hold, as the decreasing number of trades shows:

Now imagine being a trading dwarf without backtesting trying to find a viable strategy with all these parameters… in real-time and discretionary. And under the stress of everyday gold mining! Seems not so easy. A great trading strategy needs a lot of development and time, consideration of market phases and a lot of care to not overfit the data (i.e., to not just “learn the past by heart” because there are too many parameters, which then leads to bad future predictions).

Technical Analysis: What it can do

  • Technical indicators can be very useful to actually set up a deterministic (quantitative) trading strategy. It is one way to produce entry or exit signals in a calculable and reproducable way.
  • There might be some information content (prediction ability) to some indicators under certain settings. The art is to find these, and to find these without overfitting. Not just finding something that once worked by chance…

TA: What it can’t do

  • It is not a one-size-fits-all reliable prediction tool for future price. Especially standard settings known to all traders might not be the best possible settings.

TA: Further remarks

  • The worldly author thinks that discussing TA only makes sense within the setting of a strategy (such as take-profit and stop-loss, time frame, etc.). Or at least some quality criterion should be used (e. g., “more than X % of the the time after this-or-that indicator constellation the price increased at least Y % within Z days measured as open price.”).
  • Serious scrutiny of success chances is only possible if TA’s use is not purely discretionary and non-reproducible. The worldly author of this finance dwarves blog, however, wishes best of luck to any kind of gnomish traders out there!

Coding human’s acknowledgements: Studies were carried out using backtrader (https://www.backtrader.com/) within the PyCharm IDE (https://www.jetbrains.com/pycharm/), among other libraries, especially plotly https://github.com/plotly/plotly.py. A big thank you to the developers for providing such great user-friendly and reliable tools.

If you’d like to get more information on input parameters (commission etc.) or raw data, feel free to reach out. Some of these were intentionally left out to keep the simplicity of the article.

DISCLAIMER: This article presents my own learnings based on studies generated on synthesized (random, i.e., artificial) data which is statistically similar to real-world time series, and personal experience. The content is, thus, purely educational. Past performance is not a reliable indicator of future results. The article should not be considered Financial or Legal Advice. Consult a financial professional before making any major financial decisions.

--

--

harry_can

Open-minded engineer and PhD with a strong finance hobby, striving to provide and gain practical knowledge.