Introducing Technical Analysis

“Simply put, technical analysis is the study of prices, with charts being the primary tool”, Steven Achelis, Technical Analysis From A to Z


This introduction will examine some of the general themes of technical analysis, and a methodology of analysing and filtering down to three technical trading rules. It will review the concept of technical analysis and the basics behind each of the common technical indicators tested, before showing how they may be incorporated into trading strategies.

The theoretical rules have been applied to the movements in the British Petroleum (BP) share price. The dataset selected is purposefully historical and arbitrary, with the intent only to broadly introduce technical analysis as a tool. The profitability of each rule across the data set is assessed by comparing them to each other, a buy and hold on BP stock, and the UK FTSE 100 returns over the same period.

The evaluation introduces and involves a three-tiered assessment procedure, ensuring a more objective analysis. The data is segmented in order to formulate trading rules, test their reliability and finally use one rule to indicate profitable trades.

Overview of Technical Analysis

Dating back to the work of Wall Street Journal Editor Charles Dow, technical analysis uses historical price behavior to guide future investment strategies. Simple trading ‘rules’ are developed from historical data and trends, in the belief that the future lies in the past.

There are three general principles that guide the behavior of technical analysts, as outlined by Christopher Nelly, in Technical Analysis in the Foreign Exchange Market: A Layman’s Guide, Federal Reserve Bank of St. Louis Review, September/October 1997;

**It’s all in the Price: Technical Analysts believe that the market includes all relevant information in the asset price, therefore all you need to know is in the price history and there is no necessity to forecast the fundamentals of an asset’s value.

**Follow trends, don’t set them: Supported by Newton’s law of motion, traders and investors believe that trends will remain in motion unless acted upon by another force. Spotting repetitive trends is the cornerstone of profitability for technical analysts, who seek to sell in downward trends (or at the peaks/top of the market) and buy in upward trends (or at the troughs/low of the market).

**It’s just another case of history repeating: Technical analysts hold that when the market is confronted by the same conditions as on a previous occasion, it can be expected to behave in the same manner.

Governed by these principles, technical analysis seeks to identify and exploit trends and patterns.

Example Methodology

To test technical trading rules, an asset or an index across a period of time is selected. The dataset chosen here to assess the profitability of a selection of trading rules is that of BP stock from 1 January 2001 to 31 March 2003.

The data is split into three components: a training set; a test set; and a prediction set:

**Training Set: 1 January 2001 – 26 July 2002 (70% of Sample): **

  • In this set the data is examined, looking for any patterns and formulating any rules that appear profitable

**Test Set: 27 July 2002 – 7 January 2003 (20% of Sample): **

  • Once the rules have been developed in the training set, the rules are tested on the test set

**Prediction Set: 8 January 2003- 31 March 2003 (10% of Sample): **

  • If rules are vindicated by the test set, they may then be used on the final 10% of data to predict profitable trades. If any rules are profitable across the prediction set, it may then be justifiable to use them for future trades


The returns on the UK FTSE 100 over the same period have been used as a benchmark against which the returns of the trading strategies may be compared.

The tests make several assumptions for simplicity:

**There is no bid-ask spread to reduce the profitability of executing trades **There are no transaction costs that will penalise trading strategies that require frequent trading **The market is continually liquid and there will be no slippage on any of the trades

Formulating Trading Rules

The Training Set:

There are many automated and manual systems and methods through which to undertake technical analysis studies. In this case the training period data was run through a Metastock system testing procedure to find the most profitable trading rules. The following graph displays the overall profitability of a range of 2500 trading rules. The chart broadly details the ten best performing rules. With systems such as the ‘Moving Average Crossovers’ incorporating an optimization function, whereby all combinations of shorter MA from 1-50 and longer MA from 51-100, for example, may be tested on the data set , the Net Profits of all tests within a particular system are averaged across the rules. This gives a useful indication of the rules’ performance, but does not yet give an optimal rule for the specific data set. The significance of this lies, for example, in the inability to utilise any long-period moving average process on a very small data set.



Thus the next stage is to analyse the three best performing general systems, in order to obtain the optimal parameters that will prove testable on the testing and prediction sets. This supplies three specific top performing rules:

Rule One: Moving Average Convergence-Divergence (45):

Moving averages are one of the oldest and simplest technical indicators, yet remain extremely popular with market practitioners. In order to calculate a moving average, one simply needs to specify a time frame, (e.g. 10 days), and have ample historical price data to hand (e.g. 50 days). The calculation can then be done for every ten day period over the course of the past 50 days. For example, the second point on such a chart would be the sum of the prices of days 2-11 divided by 10, and so forth.

Connecting all the points on the chart leaves a smooth price trend. A buy signal is observed once the price crosses above the moving average and the moving average is directed upwards. A sell signal is denoted by the price crossing below a downward trending moving average. The rationale for this is that if the asset price is above the moving average it shows that current market/investor expectations are more bullish on this asset than the average expectations over the past 10 days, and vice versa for a sell signal.

Two moving averages (e.g. 10 and 20 day moving averages) can be used in conjunction with each other in order to generate buy and sell signals. In its simplest form, it is sufficient to say a buy signal is given by the short dated average penetrating above the longer dated average when both are moving in an upward direction, and the reverse scenario for a sell signal.

So investors should always be on the ‘right’ side of the market when employing a moving average indicator, since prices cannot rise significantly without exceeding their average price. However, such an approach will always buy and sell late, since the trend is simply being followed once it has been set.

This analysis uses what is known as the Moving Average Convergence Divergence (MACD). This involves subtracting a longer dated moving average from a shorter dated moving average. The resulting momentum indicator oscillates above and below zero as the moving averages cross. Thus, a MACD above zero shows current expectations to be more bullish than previously, thereby implying an upward shift in the stock. The reverse is true for a negative MACD. A moving average of the MACD itself is plotted (not of the stock). This is known as the ‘signal line’ and anticipates the movement of the MACD toward the zero line. Typically, when the MACD rises above the zero line or crosses the signal line from below it is a buy signal, and falling below the zero line or crossing the signal line from above represents a sell signal.

Here, the MA optimization parameters are set to between 1 and 50. Testing all permutations of the rule, the optimal result is obtained by utilising a 45 day period, (and using 12/26 day MA’s to calculate MACD).

Rule Two: Stochastics (36/88):

The stochastic oscillator compares where a security's price has closed relative to its price range over a specifically identified period of time. The theory behind this indicator is that in an upwardly trending market, prices tend to close near their high; and during a downward trending market, prices tend to close near their low. Further, as an upward trend matures, price tends to close further away from its high; and as a downward trend matures, price tends to close away from its low.

The stochastic indicator is plotted as two lines. This system incorporates two optimization parameters, namely the %D line (set between 1 and 50 days) and the %K line (set between 51 and 100). Testing these parameters against the training set results in optimal values for the %D and %K line of 36% and 88% respectively. Results above 88% suggest that the stock is closing near its high and as such should be sold, whereas results below 36% suggest that the stock is closing near its low and should be bought.

Rule Three: Bull Power Bear Power 3:

Candlesticks are a representation of the open, high, low and close of a security. If the close is above the open, then a hollow/white candlestick is displayed. Conversely, if the close is below the open, then a filled/black candlestick is shown. The white/black part of the candlestick is referred to as the ‘body’. The thin lines above and below the body are known as the shadows or wicks, and represent the high/low range. The upper shadow represents the high and the lower shadow represents the low. Candlesticks are often represented using green and red in place of white and black respectively.

Candlesticks offer quick visual market/price representation. The white candlesticks indicate buying pressure, (close > open), and the black candlesticks indicate selling pressure (close < open). Furthermore, a long candlestick represents strong buying or selling pressure (the longer the candlestick the greater the disparity between the open and the close), while a short candlestick is indicative of slow static markets.

A bullish sign is a long white body followed by three small black bodies and another long white body. The three black bodies are contained within the first white body’s range.

Buy when this pattern is observed:


The candlesticks suggest a bearish outlook when a long black body is followed by three small white bodies and another black body. The three white bodies are contained within the first black body’s range.

Sell when this pattern is observed.


Overall Trading Rule Performance in the Training Set:

The following results compare the returns of these initial three trading rules with the benchmark, across the training set:

Trading Strategy & Returns:

  • MACD 16.7%
  • Stochastics 21.3%
  • Bull-Bear Candlesticks 71.8%
  • FTSE 100 (Benchmark) -35.3%
  • Buy-&-Hold -18.9%

The benchmark and the stock fall significantly over the period. During this bearish period, all three of these trading rules emerge as strongly performing strategies:

The Test Set:

Each of these trading strategies is then analysed for performance across the testing period:

'Rule One: Moving Average Convergence Divergence 45 (MACD):


The top panel in the above graph shows the profit/loss profile across the test set for this trading rule. The middle panel shows movements in the stock price and buy/sell points. Finally, the bottom panel shows the trading volumes across the data set.

Summary Performance

  • Profit 4.7%
  • Buy & Hold Profit -7%

Trade Summary

  • Total Trades 2
  • Profitable Trades 2
  • Highest Profit 2.5%
  • Unprofitable Trades 0
  • Highest Loss 0

The MACD indicator returns a profit of 4.7%. It made only 2 trades due to the lag effect of a relatively large moving average of 45 days in a short (162 day) test period. This indicator significantly outperformed the negative returns from the benchmark of -14% and buy-and-hold strategy of -7%

Rule Two: Stochastic 36 88 optimized:


This profit profile shows that the rule has performed strongly across the period, whilst the stock has been falling in value. The rule performs precisely how an ideal trading rule would behave under such circumstances; by going short of a stock that fell significantly across the period.

Summary Performance

  • Profit 17.9%
  • Buy & Hold Profit -7%

Trade Summary

  • Total Trades 1
  • Profitable Trades 1
  • Highest Profit 17.9%
  • Unprofitable Trades 0
  • Highest Loss 0

This rule was the most profitable of the 3 indicators in the test set. For the same period, the FTSE 100 benchmark index returned -14% and buy-and-hold -7%

Bull Power Bear Power 3:

The Bull Power Bear Power 3 strategy provided a positive return across the period:


Summary Performance

  • Profit 0.7%
  • Buy & Hold Profit -7%

Trade Summary

  • Total Trades 6
  • Profitable Trades 2
  • Highest Profit 14.3%
  • Unprofitable Trades 4
  • Highest Loss 6.3%

The Bull Power Bear Power 3 indicator was the most active of the trading tools over the test period with 6 trades that resulted in a return of 0.7%. Whilst it did not perform as well as the other two in this instance, it is important to bear in mind that the test set is significantly smaller than the original trading set and it has reaped positive returns above the benchmark of -14% and the buy-and-hold return of -7%.

Overall Performance of Individual Trading Strategies - Trading Strategy & Returns From Test Set Data:

  • MACD 4.7%
  • Stochastics 17.9%
  • Bull-Bear Candlesticks 0.7%
  • FTSE 100 (Benchmark) -14%
  • Buy-&-Hold -7%

Rule Combinations:

As part of the analysis across the test set, combinations of the three most successful trading rules may be developed. On testing only one of these combinations is profitable:

Combination Trading Rule One: Bull Power Bear Power 3 & MACD 45:

Summary Performance

  • Profit 2.8%
  • Buy and Hold Profit -7%

Trade Summary

  • Total Trades 6
  • Profitable Trades 4
  • Highest Profit 4.8%
  • Unprofitable Trades 2
  • Highest Loss -4.2%

Combination Trading Rule Two: MACD 45 & Stochastic 36 88:

Summary Performance

  • Profit -1.9%
  • Buy and Hold Profit -7%

Trade Summary

  • Total Trades 5
  • Profitable Trades 1
  • Highest Profit 3.96%
  • Unprofitable Trades 4
  • Highest Loss -3%

Combination Trading Rule Three: Bull Power Bear Power 3 & Stochastic 36 88:

Summary Performance

  • Profit -7.5%
  • Buy and Hold Profit -7%

Trade Summary

  • Total Trades 13
  • Profitable Trades 4
  • Highest Profit 14.3%
  • Unprofitable Trades 9
  • Highest Loss -6.7%

Combination Trading Rule Four: Bull Power Bear Power 3 & Stochastic 36 88 & MACD 45:

Summary Performance

  • Profit -3.75%
  • Buy and Hold Profit 7%

Trade Summary

  • Total Trades 9
  • Profitable Trades 4
  • Highest Profit 3.3%
  • Unprofitable Trades 5
  • Highest Loss -4.2%

Overall Combination Trading Rules Performance:


The general weakness of the combination trading rules means that only the combination rule that results in positive profits is considered: the Bull Power Bear Power 3 & MACD (45) combination. Unfortunately, as this test requires a 45-day moving average, the prediction set of 58 days is not sufficient.

Prediction Set:

With the results of the test set, the next step is assessment over the prediction period. Whilst the Bull Power Bear Power 3 trading rule does not perform as strongly as the other indicators in the test set, it still significantly outperformed the benchmark and a buy-and-hold strategy. The trading rule would provide positive returns in a bear market. As the rule earned positive returns in the test set, and outperformed the other rules by over 300% in the training set, it is applied to the prediction set.

For completeness a more comprehensive study would be undertaken to judge all three rules and combinations; in this case the Bull Power Bear Power 3 trading rule is assessed. For an example of the process, running this rule across the prediction set results in a positive return, greater than both the benchmark and the buy-and-hold strategy:

Trading Strategy & Returns:

  • Bull Power Bear Power 3 6.6%
  • FTSE 100 (Benchmark) 1.0%
  • Buy-&-Hold -4.1%


Having conducted a largely objective analysis of the BP data set across the three periods, the Bull Power Bear Power 3 trading rule would provide a financially rewarding conclusion. Although on first assessment it may be difficult to asses the reasons behind any success or failure, the underlying nature of how exactly this rule works goes some way to explain its benefits.

Incorporating a Candlestick method into the Technical Analysis case study provides a representation of the stock’s open, high, low and closing prices. This method is indicative of overall market buying/selling pressures and also gives an idea of the levels of disparity.

In this case the Bull Power Bear Power 3 may be recommended with some confidence as a technical indicator on BP stock, demonstrating one approach in the application of Technical Analysis and rule filtering.

For an application of this approach to Bitcoin (BTC), refer to Applying Technical Analysis Rule Generation to Bitcoin


Achelis, Steven. B., Technical Analysis From A to Z

Brock, W., J. Lakonishok and B. Le Baron, Simple technical trading rules and the stochastic properties of stock returns, Journal of Finance, 47, 1731-1764, 1992

Malkiel, B.G., A Random Walk Down Wall Street: including a life cycle to personal investing, (6th Edition) 1999

Neely, Cristopher. J., Technical Analysis in the Foreign Exchange Market: A Layman’s Guide, Federal Reserve Bank of St. Louis Review, September/October 1997

Treynor J., and R. Ferguson, In defense of technical analysis, Journal of Finance, xxx, 757-773, 1985

Treynor, M.P., and H. Allen, The use of technical analysis in the foreign exchange market, Journal of International Money and Finance, 304-314, 1992


QR Code
QR Code technical_analysis_introduction (generated for current page)