# What is a technical indicator?

Technical Analysis (TA in short) is a method of finding trade opportunities by analyzing past prices. It is based on the belief that a number of well-known technical indicators gives insight into the market situation and can generate trade signals for buying and selling at the right moments.

Normally you want to know if the price will rise or fall. For this prediction you use the prices of past bars - say the last 100 bars. So you have 100 price values that you want to reduce to a single number that predicts the future price trend, and thus gives you a signal whether to buy or to sell. Mathematically, you want to get rid of 99 degrees of freedom, using a transformation function from a 100-dimensional space into a 1-dimensional space. Such a function is called a technical indicator*.

 Price 1 Indicator Function Buy/Sell Signal Price 2 Price 3 ... Price 100

Calculating with 100 dimensions sounds complicated, but most indicators are primitive. For instance, the Simple Moving Average (SMA) indicator just adds all 100 prices and divides the sum by 100. The result is the average price of the last 100 bars. If the current price rises above the average, some traders believe that prices will further rise, and take this as a buy signal. It the price falls below the average, they believe that prices will further fall and they must sell. At least that's the theory.

Of course, instead of the last 100 bars you can use any different number of bars, differentiate between the high, low, open, and close prices of a candle, or use other data such as the market volume. And instead of averaging the prices, other indicators calculate their variance, their rate of change, their breakout from a given range, their maxima and minima in a given time period, and so on. All indicators can generate buy or sell signals when reaching a threshold or crossing each other. Because they are not based on a mathematical foundation or solid theory, anyone can anytime invent new indicators, and anyone does. About 600 different TA indicator functions are meanwhile published in books and trader's magazines.For any arbitrary point in any price curve there are many indicators that recommend buying and many others that recommend selling. This might give you the impression that something must be wrong with TA: If any one of the 600 indicators would really work, there would be obviously no need for the other 599. So you might come to the conclusion that technical indicators are just garbage. In fact it's a little more complicated.

### Are indicators predictive?

Traders obviously think that they are, otherwise they wouldn't use them. People with some math background normally think that they aren't, and disdain the uneducated traders. However, predictivity is not a property of an indicator, but also of a price curve. Purely random curves cannot be predicted, no matter with which indicator. Heavily trending curves are predictable with almost all indicators. So the real question is whether real price curves are predictable with the usual technical indicators.

The answer is "most likely no". Technical indicators were first seriously tested in 2007 by Prof. D. Aronson of Baruch college**. His study involved thousands of trade rules with all classical indicator types and price, volume, and interest data series from 1980 to 2005. The results were adjusted by a bootstrap algorithm (described in his book) for eliminating data mining bias. In this study, none of the tested classical indicators came out with any predictive value. They fared no better than flipping a coin. However, the rules were only used for trading the S&P 500 index, so the question is still open if indicators can be more predictive with other markets, or if better, more complex indicators can be predictive even with the S&P 500.

This does not mean that classic technical indicators are worthless. They can be temporarily successful when a predictive pattern develops within a limited market and time period. An example was the famous Turtle Trading System that used the Donchian Channel (DC) for trade signals in the 1980's. Unfortunately this system ceased to be profitable after about 10 years. Some indicators can deliver useful nonpredictive information - for instance, the Average True Range (ATR) indicator determines the price volatility and is often used for stop loss limits. New studies*** found that indicators become predictive when their parameters are regularly adapted to the market situation, either by a Walk Forward Optimization with retraining in real time, or by using market properties - such as the dominant price cycle - for adjusting the time periods of indicators. Our own tests by feeding indicators to machine learning algorithms also suggest a weak predictive power in complex combinations of certain indicators. Therefore, Zorro supports most classical indicators found in the literature. Only the very whacky, such as financial astrology, Elliott waves, Gann lines, etc. are not included - but you can add even them if you're on the esoteric side.

It is very easy to define your own indicators. Most of them require only a few lines of code. The file include\indicators.c contains the source codes of almost all nonstandard indicators, so you can use it as learning material for adding new indicators.

Aside of the traditional indicators with their dubious value for generating trade signals, what else can we use? Zorro comes with new tools that rely on sound mathematics and can detect any sort of predictability or inefficiency in a price curve. There are many advanced functions for statistical analysis of price series. Polynomial regression can often anticipate a small part of a price curve. Spectral analysis can remove noise and detect cycles or seasonality. For finding price curve patterns, a pattern detector is implemented, based on a similar algorithm as in PDA handwriting recognition. Perceptrons and decisions trees can generate trade rules from raw price data. You'll learn in the workshops how to use those advanced tools.

For having a look at some typical indicators, select the script Indicatortest, and click [Test]. You should see a chart like this:

The blue envelope is a Bollinger Band, a classical indicator. You can  the script for experimenting with other indicators or analysis functions. Just add more plot commands. It's quite simple:

```// Indicatortest ///////////////////

function run()
{
BarPeriod = slider(0,24*60,0,0,0,0);
set(PLOTNOW|PLOTPRICE);

// plot Bollinger bands
BBands(series(price()),30,2,2,MAType_SMA);
plot("Bollinger1",rRealUpperBand,BAND1,0x000000CC);
plot("Bollinger2",rRealLowerBand,BAND2,0x800000FF);

// plot some other indicators
plot("ATR (PIP)",ATR(10)/PIP,NEW,RED);
plot("Doji",CDLDoji(),NEW,BLUE);
plot("Fractal",FractalDimension(Price,20),NEW,RED);
}
```

* For a comprehensive list of classical indicators, see Perry J. Kaufman, New Trading Systems and Methods (2008)
** Described and published in David R. Aronson, Evidence-Based Technical Analysis (2007)
*** Study with 40,000 trade rules by P.H. Hsu and C.M. Kuan, published in Journal of Financial Econometrics 3, No. 4 (2007)