Certain parts of this chapter will rely on your understanding of the chapter Basic Structure.
This chapter is comprised of the topics listed below. Click on the desired topic to move automatically to its corresponding description.
Formulas for basic indicators
Formulas for liquidity indicators
Formulas for statistical indicators
Formulas for style analysis indicators
Formulas for technical analysis indicators
Accumulated Relative Strength Index
Characteristics : The technical indicators available on the system are results of calculations performed on stock prices.
Example: Volatility is the standard deviation of the logarithm of the daily stock price variations in a selected period.
Therefore, many of the details reviewed in our discussion of stock prices (characteristics, parameters, etc.) are also applicable to the technical indicators. To fully understand the technical indicators, in addition to reviewing the chapter Stock Prices, we explore other details in this chapter.
Specific window: There is not a specified window for the technical indicators since each indicator has its own set of parameters and we cannot have a general set of parameters which would apply to all the technical indicators shown in such a specific window. The technical indicators can only be viewed via the Graphs window or via Stock Guide or Matrixx columns.
Parameters: In setting a graph, a Stock Guide column or a Matrixx column (as described in their respective chapters) you must define the indicator's parameters according to your needs. Each technical indicator has its own unique set of parameters.
Example: The Parabolic technical indicator includes the parameters Step and Limit. These two parameters are exclusive to the Parabolic technical indicator
We will not explore the specific parameters of each technical indicator as the purpose of this manual is to cover only the navigational aspect of the system. Users are expected to have a basic understanding of technical analysis to set the parameters appropriately
FORMULAS
The price change of closing prices between the data [h] and, on the previous day, [h-1], for example is:
= 100 * (1 - (close[h] / close[h-1]))
5-day moving average of closing prices, for example, calculated for data [h]:
= (close[h] + close[h-1] + close[h-2] + close[h-3] + close[h-4]) / 5
A 5-day moving average of volume, for example, calculated for data [h]:
= (vol[h] + vol[h-1] + vol[h-2] + vol[h-3] + vol[h-4]) / 5
EM[t] = EM[t-1] + F * (P - EM[t-1])
where:
EM[t] = Exponential Mov.Avg.
EM[t-1] = Previous Exponential Mov.Avg.
F = 2/ (N+1), where N denotes the number of days to be calculated for EM
P = current price
WM = (P[t] * N + P[t-1] * (N-1) + P[t-2] * (N-2) + ... + P[t-N]) / N + (N-1) + (N-2) +....+ (N-N)
where:
WM = Weighted Mov.Avg.
P[t] = price
P[t-1]= previous price
N = number of days to be calculated for WM
Bar Chart and Candle Sticks: As discussed earlier, the technical indicators may be viewed in graphical form or numerical form in a stock guide column. However, the bar chart and candle sticks are exceptions as they can only be viewed in a graph and obviously cannot be presented in StockGuide columns
= 100 * p/P * sqrt(n/N * v/V)
where:
p (small) = number of days in which there were at least 1 trade of the stock during the period
P (max) = total number of days in the period
n (small) = number of trades of the stock during the period
N (max) = total number of trades of all the stocks in the period
v (small) = volume in monetary terms of the stock in the period
V (max) = total volume in monetary terms of all the stocks in the period
= 100 * p/P
where:
p (small) = number of days in which there were at least 1 trade of the stock during the period
P (max) = total number of days in the period
Same as the average indicator except that the field Calculated on is already set to Volume$
The calculation of Volatility for n days uses a series of closing prices of n+1 days: d0,d1,d2,d3,...,dn
= sqrt ( (sum ((Si - Sm)^2)) / n * PPA )
where:
Si = natural logarithm of (di / di-1) i = 1...n
Sm = average of S1, S2, S3,....,Sn
PPA means Periods Per Annum and is:
PPA = 252 when daily closes are used
PPA = 52 when weekly closes are used
PPA = 12 when monthly closes are used
PPA = 4 when quarterly closes are used
PPA = 1 when yearly closes are used
Bibliography: Financial Analysts Journal, nov/dec 1992
The formula above yields volatility on an annual basis. To obtain volatility on basis other than annual (period x) the formula is :
Volatility[basis.x] = Volatility[annual.basis] * sqrt ( working.days.in.period.x / 252)
= standard.deviation ( Close[n] / Close[n-1] - 1 ) * sqrt (PPA)
PPA means Periods Per Annum and is:
PPA = 252 when daily closes are used
PPA = 52 when weekly closes are used
PPA = 12 when monthly closes are used
PPA = 4 when quarterly closes are used
PPA = 1 when yearly closes are used
The formula above yields risk on an annual basis. To obtain risk on basis other than annual (period x) the formula is :
Risk[basis.x] = Risk[annual.basis] * sqrt ( working.days.in.period.x / 252)
= standard.deviation ( Close[n] / Close[n-1] - Benchmark[n] / Benchmark[n-1] ) * sqrt (PPA)
PPA means Periods Per Annum and is:
PPA = 252 when daily closes are used
PPA = 52 when weekly closes are used
PPA = 12 when monthly closes are used
PPA = 4 when quarterly closes are used
PPA = 1 when yearly closes are used
The formula above yields TE on an annual basis. To obtain TE on basis other than annual (period x) the formula is :
TE[basis.x] = TE[annual.basis] * sqrt ( working.days.in.period.x / 252)
=
ICDF ( confidence_level ) * SD * number_of_periods
where:
ICDF() is the inverse of the "cumulative distribution function"
see http://en.wikipedia.org/wiki/Normal_distribution
SD is the standard deviation of the returns per period of the time horizon
number_of_periods is the number of periods in the time horizon
Jensen's Alpha
= (AverageReturn - AverageReturnRF) - Beta * (AverageReturnBM - AverageReturnRF)
where:
AverageReturn is the average return of the stock being analyzed
AverageReturnRF is the average return of the risk free investment
AverageReturnBM is the average return of the benchmark
Beta is the beta of the stock being analyzed_
The Beta calculation is performed based on price changes of the stock and the index during a certain time interval.
= Covar [OscStock, OscIndex] / DVP [OscIndex]
where:
Covar = the Covariance function
DVP = the Standard Deviation function
OscStock = price changes of the stock
OscIndex = price changes of the index
The Correlation calculation is performed based on price changes of the stock and the index during a certain time interval.
= Covar [OscStock, OscIndex] / (DVP[OscIndex] * DVP[OscStock])
where:
Covar = the Covariance function
DVP = the Standard Deviation function
Sharpe ratio
The Bollinger Bands produce 3 values: middle band (average), upper band, and lower band. Calculation for the closing price of date[h] for n days and with standard deviation limit d:
MB = sum(close[h-i])/n
SD = sqrt(sum((close[h-i]-MB)2)/n)
UB = MB + d * SD
LB = MB - d * SD
where:
i = 0..n-1
MB = middle band (simple moving average)
UB = upper band
LB = lower band
SD = standard deviation
The formulas for the style analysis indicators are very complex and beyond the scope of this manual. To learn more we recommend the following literature:
SHARPE. Asset allocation: management style and performance measurement. Journal of Portfolio Management, v. 18 (1992), p. 7-19.
COGGIN e FABOZZI. The Handbook of Equity Style Management. 3. ed.Wiley, 2003, p. 435-453.
MUNIZ e KISTLER. Portafolios óptimos: un ejemplo práctico. Revista Informe SENN n. 23 (1994), p. 10-12.
The Parabolic indicator consists of 2 parameters which are defined via the Parameters tab in the Economatica system and which used in the calculation (these parameters are expressed in percent terms):
- Step
- Limit
As the parabolic is calculated in a cumulative form (the value each day is dependent on the calculated value of the previous day), we employ 3 numeric variables that are maintained daily to calculate the value on the following day. These variables are:
- SAR (the value of the parabolic, which is also known as Stop And Reverse)
- EP (Extreme Point)
- AF (Adjust Factor)
Additionally, we must also track each day whether the price is moving upward or downward.Upon starting the calculation on the first day of the graph, we define the following variables:
SAR = minimum price of first day
EP = maximum price of first day
AF = Step, upward direction
Therefore, the parabolic value of the first day would be the minimum of the day (SAR), and each following day it would be assigned the calculated variable SAR.From the second day on the procedure is repeated and the value of the parabolic is assigned the SAR at the end of the procedure:
During an upward price movement:
If the Minimum price of the day is less than SAR (from the previous day), then:
- SAR = EP
- EP = Mínimum of day
- AF = Step
- price movement becomes downward, therefore the procedure for the next day will conform to that described in "During a downward price movement"
otherwise:
- if the Maximum price of the day is greater than EP, then: EP = Maximum and in the next step (A) AF will be incremented
- SAR = SAR + AF/100 * (EP - SAR)
- if SAR > minimum price of the day then SAR = Minimum
- if the Maximum price of the day is greater than EP (case A) and AF < Limit then AF = AF + Step
However, if the price movement is downward, the precedure is very similar but only in the opposite direction as described below:
If the Maximum price of the day is greater than SAR (from the previous day), then:
- SAR = EP
- EP = Maximum of day
- AF = Step
- price movement becomes upward, therefore the procedure for the next day will conform to that described in "During an upward price movement"
otherwise:
- if the minimum price of the day is less than EP, then EP = minimum and in the next step (B) AF will be incremented
- SAR = SAR - AF/100 * (EP - SAR)
- if SAR < Maximum price of the day then SAR = Maximum
- if the minimum price of the day was greater than EP (case B) and AF < Limit then AF = AF + step
The parabolic value is assigned the value SAR at the end of the procedure on each day, and the next day the entire process is repeated using the Minimum and Maximum price of this day, the variables SAR, EP and AF and the upward/downward flag from the day before. The first criteria to observe each day is whether the price movement is upward or downward, and then immediately execute the procedure as detailed above.
The Relative Strength Index, for a 9-day sample, calculated for data [h]:
= 100 * highs / (highs + lows)
where:
highs[h] = average of last 9 highs
lows[h] = average of last 9 lows
high[h] = close[h] - close[h-1]
low[h] = close[h-1] - close[h]
close[h] = closing price of the day
Please Note: highs and lows cannot be negative. If a result is negative then it is truncated to 0.
Accumulated Relative Strength Index
The Accumulated Relative Strength Index for a N-day period calculated for date [h]:
= 100 * highs / (highs + lows)
where:
highs and lows on the first day are calculated as on the RSI
and from the second day on
highs [h] = ((highs [h-1] * (N-1)) + high [h]) / N
lows [h] = ((lows [h-1] * (N-1)) + low [h]) / N
A 5-day stochastics, for example, calculated for data [h]. Lines %K and %D calculated as follows:
%K = 100 * (close - min5) / (max5 - min5)
where:
max5 = maximum closing price in the last 5 days
min5 = minimum closing price in the last 5 days
%D = 100 * (m3close - m3min5) / (m3max5 - m3min5)
where:
m3close = average of last 3 closing prices
m3max5 = average of last 3 max5
m3min5 = average of last 3 min5
Slow Stochastics, lines %K and %D calculated as follows:
%K = conventional Stochastics' %D line
%D = average of last 3 %K line values
The conventional variable names that are typically used for these calculations have been changed to avoid confusion with some of the operators used. That is:
DMP (DM positive) as opposed to DM +
DMN (DM negative) as opposed to DM -
DIP (DI positive) as opposed to DI +
DIN (DI negative) as opposed to DI -
WWDM for example, for 7 days, calculated for data[h]:
mc[h] = maximum ( high[h] - high[h-1], 0 )
mb[h] = maximum ( low[h-1] - low[h], 0 )
tr[h] = the maximum of these values
high[h] - low[h]
high[h] - close[h-1]
close[h-1] - low[h]
if (mc > mb) then dmp = mc and dmn = 0
if (mc <= mb) then dmp = 0 and dmn = mb
tr7 = average of 7 last tr
dmp7 = average of 7 last dmp
dmn7 = average of 7 last dmn
DIP = 100 * dmp7 / tr7
DIN = 100 * dmn7 / tr7
dx = 100 * abs(DIP - DIN) / (DIP + DIN)
ADX = average of 7 last dx
Moving Average Convergence and Divergence, for example with the following parameters, 10 and 30 days and a signal of 7 days, is calculated for data [h]:
= EMM10 - EMM30
where:
EMM10 = Exponential Moving Avg. of 10 days over closing prices
EMM30 = Exp. Mov. Avg. of 30 days over closing prices
Signal = Exp. Mov. Avg. of 7 days over C and D
= SMA (short) - SMA (long)
where:
SMA (short) = simple moving avg. of the shorter period selected.
SMA (long) = simple moving avg. of the longer period selected.
= P - P(x)
where:
P = closing price
P(x) = closing price at x previous days
if Close[n] > Close[n-1] then OBV[n] = OBV[n-1] + Vol$[n]
if Close[n] < Close[n-1] then OBV[n] = OBV[n-1] - Vol$[n]
if Close[n] = Close[n-1] then OBV[n] = OBV[n-1]
Please Note: If the parameter is set, for example, to 100, the calculation is redone for every date using only just the last 100 trades.
Vacc[n] = Vacc[n-1] + ((Close[n] - Low[n]) - (High[n] - Close[n])) / (High[n] - Low[n]) * Vol$[n]
where:
Vacc[n] = Volume Accumulation of data selected
Vacc[n-1] = Volume Accumulation of previous period
Please Note: If the parameter is set, for example, to 100, the calculation is redone for every date using only just the last 100 trades.
The N day TRIX consists of a principal Tp and a signal Ts
- calculate the N-day exponential moving average of the closing price series
- calculate the N-day exponential moving average of the resulting series from previous step
- again calculate an N-day exponential moving average of the resulting series from previous step
- use the resulting series from the triple exponentially smoothed moving average, which we call ME3, to perform the following calculation:
Tp[d] = ( ME3[d] - ME3[d-1] ) / ME3[d-1]
- Ts is the N-day exponential moving average of the series Tp
Drawdown is the decline from the maximum value to the minimum value of a price series during a selected period of time and it’s denoted in percent terms.
It is measured from the start of the decline until it reaches a new maximum. This method is used because a valley cannot be measured until a new maximum is established. Once a new maximum is found, then the percent change from the previous maximum until the minimum is calculated.
The maximum drawdown is the highest drawdown that ocurred in the period selected by the user.
Available Indicators: Certain stock exchanges do not disclose full pricing information, particularly omitting the following items: number of trades, monetary volume, average, and open. In these cases, indicators which rely on these items in their calculation will not be available.
Example 1: The liquidity indicator will not be available for stock exchanges which do not report number of trades.
Example 2: The candle stick will not be available for stock exchanges which do not report the open price.