# Indicators

*App::financeta* supports a variety of indicators, about 132 of them. Here we
try to explain each one of them and for those that have better references
elsewhere we link to detailed explanations to those sites. We felt that there
was no reason to copy some other site’s text when we could just link to their
efforts.

Each indicator’s parameters are listed if necessary and explanations are given as required for understanding how to use the indicator.

## Overlap Studies

These group of __trend following__ indicators work with the Close price of the security being used
as the input. They overlap the actual security price chart and hence the name.

### Moving Average (MA)

Moving average is the easiest and simplest smoothing indicator used by technical analysts and algorithmic traders. Fundamentally, they are implemented as running an averaging formula over a rolling window of prices.

Analysts use a combination of various moving average lines to create simple trading rules for securities. The moving average along with a few other indicators can be applied to any kind of security such as stocks, futures or options to smooth the volatility over fixed periods and get an idea of how to see trends in a price.

For more details refer the resources at:

There are many popular methods of calculating the moving average which are explained in the following sections.

This indicator is actually a collective indicator in the sense that selecting this indicator allows the user to choose which type of moving average they would like to pick. The indicator takes two parameters: the period window which is a valid integer between 2 and 100,000 and the type of moving average. Each of these types of moving averages are explained below.

#### Simple Moving Average (SMA)

The simple moving average uses the simplest averaging formula over the period window of prices. It simply adds all the prices in the period window divided by the value of the period window.

There is only one parameter for this indicator: the period window which is a valid integer between 2 and 100,000.

For more details refer the resources at:

#### Exponential Moving Average (EMA)

The exponential moving average is one of the most useful moving average indicators being used today. It has a faster reaction time compared to the SMA. The ratio or α is automatically calculated based on the period window.

There is only one parameter for this indicator: the period window which is a valid integer between 2 and 100,000.

For more details refer the resources at:

#### Double Exponential Moving Average (DEMA)

The DEMA has a lesser lag than the exponential moving average. It is a combination of the EMA output and the EMA of the EMA output.

There is only one parameter for this indicator: the period window which is a valid integer between 2 and 100,000.

For more details refer the resources at:

#### Triple Exponential Moving Average (TEMA)

The TEMA has a much lesser lag than the EMA, but has a more complex formula than DEMA.

For more details refer the resources at:

#### Triple Exponential Moving Average (T3)

The T3 is similar to the DEMA but adds a volume factor (`vfactor`

) based
scaling to the DEMA calculation. The `vfactor`

is a real number between 0.0 and
1.0. A typical value for `vfactor`

is 0.7. If the `vfactor`

is 0.0 then T3 is
the same as EMA and if it is 1.0 then T3 is the same as DEMA.

There are two parameters for this indicator: the volume factor which is a real number between 0.0 and 1.0, and the period window which is a valid integer between 2 and 100,000.

For more details refer the resources at:

#### Weighted Moving Average (WMA)

The weighted moving average applies weights to data points at different positions of the period window. The weights decrease in an arithmetic progression.

For more details refer the resources at:

#### Triangular Moving Average (TMA)

The TMA is similar to the WMA where the weights are assigned in a triangular pattern.

For more details refer the resources at:

#### Moving Average with Variable Period (MAVP)

This is a type of *Adaptive* moving average where the user provides a list of
periods to use to calculate the moving average of the series. In other words,
the period window cycles through the list and all the different moving average
series are merged into one.

This indicator takes four arguments: a list of integers (comma-separated) denoting the different periods to use, a minimum period value, a maximum period value and the type of moving average to use.

For example, the list of integers for the variable periods can be a Fibonacci
sequence of numbers
such as `2, 3, 5, 8, 13, 21, 34`

and so on.

#### Kaufman Adaptive Moving Average (KAMA)

This is a type of *Adaptive* moving average that adjusts its speed (or period
window) based on market volatility to make the moving average more
trend-efficient.

For more details refer the resources at:

#### MESA Adaptive Moving Average (MAMA)

This indicator relates the phase rate of change to the EMA α creating an adaptive EMA indicator. For more details you will need to read the original paper linked below.

This indicator uses two parameters: the upper limit and the lower limit, which are both real numbers between 0.01 and 0.99. The recommended value for the upper limit is 0.5 and the lower limit is 0.05.

For more details refer the resources at:

### Bollinger Bands (BBANDS)

Bollinger Bands is a popular volatility indicator used to indicate the rise and fall of a price relative to previous trade prices. It consists of a type of periodic moving average, an upper band a few standard deviations above the moving average and a lower band a few standard deviations below the moving average.

There are four parameters for this indicator: the period window, the number of standard deviations for the upper band, the number of standard deviations for the lower band, and the type of moving average to use.

For more details refer the resources at:

### Parabolic Stop And Reverse (SAR)

This is a popular indicator designed to find potential reversals in the market
price direction. This is a lagging indicator and may be used as a stop-loss
trigger. A parabola below the price is considered *bearish* and above the price
is considered *bullish*. This indicator works on the high and low prices of the
security rather than the close price like the moving average indicators.

There are two parameters for this indicator: an acceleration factor which is a positive real number and the maximum acceleration factor to use. The default value of acceleration factor is 0.02 and the maximum acceleration factor is 0.2.

For more details refer the resources at:

#### Parabolic Stop And Reverse - Extended (SAREXT)

This is an extension to the above SAR indicator which gives the user the freedom to use different acceleration factors for the long and short side trades.

There are many parameters that are configurable here:

- the start value which is a real number that denotes the start value and the sign of the number decides whether it is the long direction if positive, or the short direction if negative, or auto-detect if 0. The default is 0.
- the percentage offset added or removed to the initial stop on the short or long reversal. The default is 0.
- the initial acceleration factor for the long direction. The default value is 0.02.
- the acceleration factor for the long direction, with a default value of 0.02.
- the maximum acceleration factor for the long direction, with a default value of 0.2.
- the initial acceleration factor for the short direction. The default value is 0.02.
- the acceleration factor for the short direction, with a default value of 0.02.
- the maximum acceleration factor for the short direction, with a default value of 0.02.

If all the default values are used, SAREXT is the same as SAR.

## Volatility Indicators

### True Range

This indicator depicts the degree of price volatility. It uses the high, low and close prices to create the indicator value.

There are no parameters for this indicator.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Average True Range (ATR)

This indicator depicts the degree of price volatility averaged over a rolling period window. It uses the high, low and close prices to create the indicator value.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Normalized Average True Range (NATR)

This is the normalized value of the ATR. Normalization makes the ATR function more relevant in the scenarios where the price changes drastically over the long term and the user is performing cross-market or cross-security ATR comparisons. The ATR value is normalized using the close price and multiplied by 100.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

## Momentum Indicators

### Momentum

The momentum indicator measures the acceleration or deceleration of prices over a rolling period window. The indicator is applied to the close price, although it can be applied to any data series.

There is only one parameter for this indicator: the period window which is a valid integer between 1 and 100,000.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Moving Average Convergence-Divergence (MACD)

MACD is a very popular indicator that reveals changes in strength, direction, momentum and duration of a trend in a security’s price. It generates three outputs: the MACD output, the MACD signal and the MACD histogram (or the divergence series) which is the difference between the MACD output and the MACD signal.

The plot of this indicator shows up as a sub-plot on the regular plot window. The histogram shows up as a bar chart and the MACD output and signal are overlaid on the histogram.

A combination of the crossing over of the MACD output and the signal over the zero-line can be used to create buy/sell signals for trading.

The calculation for the MACD is the difference of two moving average series created using two different period windows - fast and slow - where the fast period window is shorter than the slow period window. The MACD signal is the moving average of the MACD output itself over a period window generally referred to as the smoothing period window.

There are three parameters for this indicator:

- fast period window which is a valid integer from 2 to 100,000
- slow period window which is a valid integer from 2 to 100,000
- signal smoothing period window which is a valid integer from 1 to 100,000

The most common values of the period windows are 12 (fast), 26 (slow) and 9 (signal).

For more details refer the resources at:

#### MACD - with EMA

This is the default MACD indicator which uses the EMA to do the moving average.

#### MACD - Extended

This is the extended MACD indicator which allows the user to select a different moving average type for each of the fast, slow and signal smoothing period windows. If the user selects EMA for all, then this is the same as the default MACD. The default moving average types are set to SMA.

#### MACD Fixed 12/26 with EMA

This is a quicker implementation of the indicator where the user only selects the signal smoothing period window. The slow and fast period windows are fixed to 26 and 12, respectively. The moving average type is fixed to EMA.

### Money Flow Index (MFI)

MFI is an index with values between 0 and 100 used to show the value of a day’s trading over a rolling period window. It calculates a positive and negative money flow based on the typical price and volume directions and gives a scaled ratio between 0 to 100.

It is used to determine the *enthusiasm* of the market based on how much a
security has been traded.

This indicator has one parameter: the period window which is an integer between 2 and 100,000.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Relative Strength Index (RSI)

The RSI is a popular momentum indicator measuring the velocity and magnitude of directional price movements over a rolling period window. It is generally used in tandem with MACD and Stochastic to create buy and sell signals.

This indicator has one parameter: the period window which is an integer between 2 and 100,000.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Rate of Change (ROC)

The ROC is the ratio of the change in the close price today with respect to the close price a fixed number of days ago. This indicator is generally a fraction depicting the trend in the prices over time. It is used in tandem with the Momentum indicator.

This indicator takes one parameter: a period window which is an integer value between 1 and 100,000. The default period window is 10.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

- Wikipedia
- Investopedia
- FM Labs (ROCP)
- tadoc.org (ROC)
- tadoc.org (ROCP)
- tadoc.org (ROCR)
- tadoc.org (ROCR100)

#### Rate of Change - Default

The ratio between today’s close price and the previous close price is subtracted by 1 and multiplied by 100.

#### Rate of Change - Percentage (ROCP)

The ratio between today’s close price and the previous close price is subtracted by 1.

#### Rate of Change - Ratio

This is the ratio between today’s close price and the previous close price.

#### Rate of Change - Ratio scaled to 100

This is the ratio between today’s close price and the previous close price multiplied by 100.

### Stochastic

The stochastic indicator refers to the point of a current price in relation to the price range over time. The method tries to predict the turn in price change by comparing the closing price to the price range.

There are two signals named `K`

and `D`

created by using the high, low and
close prices over a fast and slow period window for the `K`

and the `D`

signals.

Typical fast and slow period windows for `K`

and `D`

are 5 and 3, respectively.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

- Wikipedia
- tadoc.org - STOCH
- tadoc.org - STOCHF
- FM Labs - STOCH and STOCHF
- tadoc.org - STOCHRSI
- FM Labs - STOCHRSI

#### Stochastic - Slow (STOCH)

This returns the slow `K`

and `D`

signal streams by using the following
parameters that are configurable by the user:

- the period window for the fast
`K`

signal which is an integer between 1 and 100,000 with a default value of 5 - the period window for the slow
`K`

signal which is an integer between 1 and 100,000 with a default value of 3 - the moving average type for the slow
`K`

signal which by default is SMA - the period window for the slow
`D`

signal which is an integer between 1 and 100,000 with a default value of 3 - the moving average type for the slow
`D`

signal which by default is SMA

#### Stochastic - Fast (STOCHF)

This returns the fast `K`

and `D`

signal streams by using the following
parameters that are configurable by the user:

- the period window for the fast
`K`

signal which is an integer between 1 and 100,000 with a default value of 5 - the period window for the fast
`D`

signal which is an integer between 1 and 100,000 with a default value of 3 - the moving average type for the fast
`D`

signal which by default is SMA

#### Stochastic - Relative Strength Index (STOCHRSI)

This indicator is special in the sense that it creates the stochastic of the RSI indicator.

The configurable parameters are as follows:

- the period window for calculating the RSI which is an integer between 2 and 100,000
- the period window for the fast
`K`

signal which is an integer between 1 and 100,000 with a default value of 5 - the period window for the fast
`D`

signal which is an integer between 1 and 100,000 with a default value of 3 - the moving average type for the fast
`D`

signal which by default is SMA

### TRIX

Trix or TRIX is the slope of the TEMA which is calculated as the ratio of the difference between today’s and yesterday’s TEMA values and today’s TEMA value scaled by a factor of 100.

There is one parameter for this indicator: the period window for the moving average which is an integer from 1 to 100,000.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Ultimate Oscillator

This oscillator is based on buying and selling *pressure* created when the close
price of the day falls within the day’s true range value.

Three different period lengths are used to average the buying or selling
*pressures* and in the ratio of 4:2:1 of the averages in the order of the
shortest to the longest period divided by 7 (4 + 2 + 1) and scaled by 100.

The parameters for this indicator are 3 values of the period windows, each being an integer from 1 to 100,000. The default values are 7, 14 and 28.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Williams’ %R

This is an oscillator that shows the relation of the current close price to the high and low prices of the previous rolling period window. Its purpose is to notify whether a security is trading near the high or the low or somewhere in between of its recent trading range.

The parameters for this indicator is a period window which is an integer from 2 to 100,000 with a default value of 14.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Commodity Channel Index (CCI)

The CCI is used to detect the beginning and end of market trends. It uses the high, low and close prices to calculate the typical price and the SMA of the typical price and retrieve a ratio between the difference of these values and their mean deviations. A value between –100 and 100 is the normal trading range, and any other values outside this range indicate over-bought or over-sold conditions.

The parameters for this indicator is a period window which is an integer from 2 to 100,000 with a default value of 14.

The plot of this indicator shows up as a sub-plot on the regular plot window.

For more details refer the resources at:

### Average Directional Movement Index (ADX)

ADX is an indicator that denotes the strength of the trend in a security’s prices. It is a lagging indicator and depends on the period window being used.

ADX combines the -DI and +DI indicator using an EMA.

There is one parameter for this indicator: the period window which is an integer between 2 and 100,000 with a default value of 14.

The plot of this indicator shows up as a sub-plot on the regular plot window.

#### ADX

The ADX is 100 times the EMA of the absolute value of DX.

For more details refer the resources at:

#### Average Directional Movement Index Rating (ADXR)

This is the ratio of the current ADX with the ADX value from the beginning of the previous rolling period window.

For more details refer the resources at:

#### Minus Directional Movement (-DM)

The -DM value is a series where the value is the difference between the previous day’s low price and the current low price if the difference is positive and greater than the difference between the previous day’s high price and the current high price, or if not, then the value is 0.

For more details refer the resources at:

#### Plus Directional Movement (+DM)

The +DM value is a series where the value is the difference between the previous day’s high price and the current high price if the difference is positive and greater than the difference between the previous day’s low price and the current low price, or if not, then the value is 0.

For more details refer the resources at:

#### Minus Directional Indicator (-DI)

The -DI value is 100 times the EMA value of -DM divided by the ATR.

For more details refer the resources at:

#### Plus Directional Indicator (+DI)

The +DI value is 100 times the EMA value of +DM divided by the ATR.

For more details refer the resources at:

### Directional Movement Index (DX)

The DX is the ratio of the differences and sum of the +DI and -DI values.

For more details refer the resources at:

### Absolute Price Oscillator (APO)

This indicator is similar to MACD in that it is the difference of a fast and slow period moving average. A value above 0 indicates a buy signal and a value below 0 indicates a sell signal.

This indicator takes three parameters: a fast rolling period window between 2 and 100,000 with a default value of 12, a slow period window between 2 and 100,000 with a default value of 26 and the type of moving average with a default value of SMA.

The plot of this indicator is overlaid on top of the price plot.

For more details refer the resources at:

### Percentage Price Oscillator (PPO)

The PPO is like APO where the generated values are the ratio of the APO values to the fast moving average multiplied by 100.

This indicator takes three parameters: a fast rolling period window between 2 and 100,000 with a default value of 12, a slow period window between 2 and 100,000 with a default value of 26 and the type of moving average with a default value of SMA.

The plot of this indicator is overlaid on top of the price plot.

For more details refer the resources at:

### Aroon

The Aroon indicator attempts to show when a new trend is beginning. The
indicator consists of two lines - *Up* and *Down* - that measure how long it has
been since the higest high and lowest low have occurred within a rolling period
window. This indicator works on the high and low prices of the security.

This indicator takes one parameter: the rolling period window which is an integer between 2 and 100,000 with a default value of 14.

The plot of this indicator is a sub-plot in the plot window.

For more details refer to the resources at:

#### Aroon Oscillator

The Aroon Oscillator is the difference between the Aroon *Up* and *Down*
values.

This indicator takes one parameter: the rolling period window which is an integer between 2 and 100,000 with a default value of 14.

The plot of this indicator is a sub-plot in the plot window.

For more details refer to the resources at:

### Chande Momentum Oscillator (CMO)

The CMO is a modified RSI where the CMO divides the net movement by the total movement.

This indicator takes one parameter: the rolling period window which is an integer between 2 and 100,000 with a default value of 14.

The plot of this indicator is a sub-plot in the plot window.

For more details refer to the resources at:

### Balance of Power (BOP)

The BOP is a simple indicator which is just a ratio of the differences of the close and open price and the high and low prices of the current day.

This indicator has no parameters.

The plot of this indicator is a sub-plot in the plot window.

For more details refer to the resources at:

## Statistic Functions

### Beta

The Beta indicator compares one security with another to give the user an indication on how these securities move with respect to each other in the market. The other security could be an index like Dow Jones Industrial Average or S&P 500 or could be another security itself.

The most common usage of Beta is to understand the volatility of a security with respect to a market index. A value less than 1 implies the security varies less than the market and a value greater than 1 implies the security varies more than the market and if the value is 1 the security follows the market.

Beta is calculated using a rolling period window which is an integer between 1 and 100,000 with a default value of 5.

The plot of this indicator has the second security overlaid on the first security and a sub-plot showing the Beta line.

For more details refer the following resources:

### Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is an indicator that compares how two securities are related to each other. It always has a value between –1.0 and 1.0. A negative value implies one of the securities moves in an opposite direction to the other and a positive value implies they move in sync. The closer these values are to the 1.0 line, the more correlated these securities are to one another.

The correlation coefficient is calculated using a rolling period window which is an integer between 1 and 100,000 with a default value of 5.

The plot of this indicator has the second security overlaid on the first security and a sub-plot showing the Beta line.

For more details refer the following resources:

### Linear Regression

Linear regression attempts to fit a straight line between several data points in such a way that the distance between each data point and the line is minimized.

For each point, a straight line over the specified previous bar period is
determined in terms of `y = b + m * x`

.

The linear regression indicators take one parameter: the rolling period window which is an integer between 2 and 100,000 with a default value of 14.

For more details refer the resources at:

#### Linear Regression - Default

This returns the series that has the value `b + m * (period - 1)`

.

The plot of this indicator is overlaid on the price plot.

#### Linear Regression Slope

This returns the series that has the value `m`

.

The plot of this indicator is in a sub-plot on the plot window.

#### Linear Regression Angle

This returns the series that has the value `m`

in degrees.

The plot of this indicator is in a sub-plot on the plot window.

#### Linear Regression Intercept

This returns the series that has the value `b`

.

The plot of this indicator is in a sub-plot on the plot window.

#### Linear Regression Forecast

This returns the series that has the value `b + m * period`

.

The plot of this indicator is overlaid on the price plot.

### Standard Deviation

Standard Deviation is a signal line created using a rolling period window of the close price multiplied by the number of standard deviations requested by the user.

This indicator has two parameters: the period window which is a value between 2 and 100,000 and the number of standard deviations requested. The default values of the period window and number of standard deviations are 5 and 1.0, respectively.

The plot of this indicator is in a sub-plot on the plot window.

For more details refer the resources at:

### Variance

Variance is similar to the standard deviation indicator where the variance is just the square of the standard deviation values.

This indicator has two parameters: the period window which is a value between 2 and 100,000 and the number of standard deviations requested. The default values of the period window and number of standard deviations are 5 and 1.0, respectively.

The plot of this indicator is in a sub-plot on the plot window.

For more details refer the resources at:

## Volume Indicators

### Accumulation/Distribution (A/D) Index

The A/D index is an indicator which takes the ratio of the changes in the high and low prices of the day relative to the close price to the difference of the high and low price of the day. This ratio is then scaled by the volume to create the A/D value which is then plotted.

The plot of this indicator overlays on the volume plot. The user must select the
*OHLC & Volume* or *Close & Volume* plot options to turn on the volume plot.

#### A/D Line

This is the base indicator as described above. It has no parameters.

For more details refer the resources at:

#### Chaikin A/D Oscillator

This indicator creates an oscillator by using a fast and slow period window moving average of the A/D values.

This indicator has two parameters: the fast period and slow period windows which are both integers between 2 and 100,000. The default values of the fast and slow periods are 3 and 10, respectively.

For more details refer the resources at:

### On Balance Volume (OBV)

The OBV is a cumulative volume indicator that is used to confirm price moves in the dominant direction. It uses the close price and the volume of the day for its output.

This indicator has no parameters.

The plot of this indicator overlays on the volume plot. The user must select the
*OHLC & Volume* or *Close & Volume* plot options to turn on the volume plot.

For more details refer to the resources at:

## Price Transform

### Typical Price (aka Pivot Point)

The typical price is an average of the high, low and close price of the day.
This indicator may also be referred to as **pivot point**.

This indicator has no parameters.

For more details refer to the resources at:

### Average Price

This indicator is an average of the open, high, low and close prices of the day.

This indicator has no parameters.

For more details refer to the resources at:

### Median Price

The median price is an average of the high and low price of the day.

This indicator has no parameters.

For more details refer to the resources at:

### Weighted Close Price

This indicator is the average of the high, low and close price of the bar with the close price multiplied by 2.

This indicator has no parameters.

For more details refer to the resources at:

### Mid-point Close over period

This indicator calculates the average of the highest and lowest values of the close prices in the period window selected.

For more details refer the resource at:

### Mid-point Price over period

This indicator calculates the average of the highest high price and lowest low price of the period window selected.

For more details refer the resource at:

## Hilbert Transform

All of these indicators are from the book by John F. Ehlers titled Rocket Science for Traders: Digital Signal Processing Applications.

These indicators have no parameters and work on the close price of the security.

The Hilbert Transform is a technique used to generate in-phase and quadrature components of a de-trended real-valued price series in order to understand variations of the instant phase and amplitude.

### Instantaneous Trendline

This indicator creates a trend line that works on the current close price bar thus not have the same lag as the various moving average indicators.

For more details refer the resources at:

### Dominant Cycle Period

This returns the period of the dominant cycle of the price series. The dominant
cycle can be thought of as being the *most likely* period of a sine function of
the price series.

For more details refer the resources at:

### Dominant Cycle Phase

The dominant cycle phase is a value between 0° and 360° and returns the phase of the dominant cycle of the Hilbert Transform of the price series.

For more details refer the resources at:

### In-Phase & Quadrature

This indicator returns the in-phase and quadrature components of the price series.

For more details refer the resources at:

### Sine Wave

This indicator returns two sets of values: the sine and the *lead sine* waves.
The sine wave is just the sine of the Dominant Cycle
Phase. The *lead sine* is the sine of the Dominant Cycle
Phase advanced by 45°.

For more details refer the resources at:

### Market Mode (Trend vs Cycle)

This indicator returns a series of 0’s and 1’s denoting whether the price series is in a trend mode (denoted by 1) or not (denoted by 0).

For more details refer the resources at:

## Candlestick Patterns

**We shall be documenting candlestick patterns in detail soon.** Until then please
refer Wikipedia. They
explain most of the patterns we support.

The output of the candlestick pattern indicators is a series of integers which
we overlay on the price plot window as straight lines when they are non-zero.
The plot of these candlestick patterns will only show if the user has selected
*Candlesticks* or *Candlesticks & Volume* plot in the Plot options.

Now that you are aware of the indicators that you may want to use, let’s learn how to write some rules to generate buy and sell signals in the next chapter.