# Indicator Functions

This section describes many of the indicator functions that can be used in BullScript. Many of these indicators are written in BullScript themselves, and use the alias attribute to make themselves available to other scripts.

## Accumulation Swing Index

**Usage**

ASWING(LIMITMOVE)

- limitmove
- Limit on movement.

**Description**

Calculates the accumulation swing index, with the given limit on movement.

Developed by Welles Wilder, the Accumulation Swing Index compares current prices and previous prices to illustrate the ‘real’ price of a security. It is the cumulative total of another indicator also developed by Wilder, known as the Swing Index

**Example**

aswing(2.0)

**See Also**

## Accumulation/Distribution

**Usage**

AD()

**Description**

Calculates the accumulation/distribution indicator according to this formula: sum((((C – L) – (H – C))/(H – L))*V)

The accumulation distribution formula is an improved On Balance Volume indicator. This indicator uses a relationship between volume and prices to estimate the strength of price movements. If the volume is increased, there is a high probability that prices will move up.

**See Also**

On Balance Volume | Chaikin Accumulation/Distribution Oscillator

## Aroon Down

Usage

AROONUP(N) AROONDOWN(N)

- n
- The number of bars used to calculate Aroon.

**Description**

AroonUp and AroonDown calculate the ‘up’ and ‘down’ portion respectively of the Aroon indicator, developed by Tushar Chande, over n bars.

**Example**

aroonup(24)

aroondown(24)

## Average Directional Movement

**Usage**

ADX(N)

- n
- The number of bars used to calculate Average Directional Movement.

**Description**

Calculates Wilder’s Average Directional Movement indicator over *n* bars.

Wilder’s Average Directional Movement is used to evaluate the strength of the current trend, be it up or down. Low readings, below 20, indicate a weak trend and high readings, above 40, indicate a strong trend. The indicator does not grade the trend as bullish or bearish, but merely assesses the strength of the current trend.

**Example**

adx(14)

**See Also**

## Average True Range

**Usage**

ATR(N)

- n
- The number of bars used to calculate Average True Range.

Description

Calculates the Average True Range indicator over *n* bars.

Average True Range is an indicator that measures commitment comparing the range between high, low and close prices. This indicator was developed by J. Welles Wilder.

**Example**

atr(24)

**See Also**

## Bollinger Bands

**Usage**

BBANDTOP(EXPR,N,METHOD,DEVIATIONS) BBANDBOT(EXPR,N,METHOD,DEVIATIONS)

- expr
- The data that the bollinger bands will be calculated over. Typically closing price.
- n
- The number of periods used to calculate the bands.
- method
- The moving average method used.
- deviations
- The number of standard deviations that the band will be away from the moving average line.

**Description**

BBandTop and BBandBot calculate the top and bottom line respectively of the Bollinger Band for expr over n periods, using the given number of deviations.

**Example**

bbandbot(C,14,S,1)

## Chaikin Accumulation/Distribution Oscillator

**Usage**

CO()

**Description**

Calculates the Chaiking Accumulation/Distribution Oscillator.

The Chaikin Oscillator indicator is the difference between a 3-day exponential moving average and a 10-day exponential moving average applied to Accumulation Distribution.

**See Also**

## Chaikin’s Money Flow

**Usage**

CMF(N)

- n
- The number of periods to calculate the money flow over.

**Description**

Calculates Chakin�s Money Flow over n periods.

Chaikin Money Flow compares total volume to the closing price and the daily highs and lows to determine how many issues are bought and sold of a particular security.

**Example**

cmf(14)

## Chande Momentum Oscillator

**Usage**

CMO(EXPR,N)

- expr
- The data to use when calculating CMO.
- n
- The number of periods to calculate the CMO over.

**Description**

Calculates the Chande Momentum Oscillator for *expr* over *n* periods. The Chande Momentum Oscillator is an advanced momentum oscillator calculated using linear regression techniques.

**Example**

cmo(C,21)

## Commodity Channel Index

**Usage**

CCI(N)

- n
- The number of periods to calculate the CCI over.

**Description**

Calculates the Commodity Channel Index indicator for *n* periods. The Commodity Channel Index compares Prices with its moving averages.

**Example**

cci(21)

## Commodity Selection Index

**Usage**

CSI(N,VALUE,MARGIN,COMMISSION)

- n
- The number of periods to calculate the CSI over.
- value
- The value to use
- margin
- The margin to use
- commission
- The commission to use

**Description**

Calculates Wilder’s Commodity Selection Index over *n* periods, using the given *value*, *margin*, and *commission*.

**Example**

csi(21,80,1800,20)

**See Also**

## Coppock

**Usage**

Coppock(EXPRESSION)

- expression
- The data to use for the Coppock curve calculation. Close is typically used.

**Description**

The Coppock function calculates the Coppock Curve indicator using the data specified by *expression*.

It is one of the few indicators to signal the tops of markets. However, like many oscillators there can be premature signals particularly in bull markets. The Coppock Curve was developed by Edwin Sedgwick Coppock in 1962. It was designed against a closing monthly index such as the All Ords or Dow Jones monthly chart to indicate overall market trends.

**Example**

{Calculate the change in the coppock curve over the last six months}

[period=Monthly]

coppock(Close)-hist(coppock(Close),6);

## Double Exponential Moving Average (DEMA)

**Usage**

DEMA(EXPR,N)

- n
- Number of periods.
- expr
- Data to calculate over.

**Description**

Calculates the Double Exponential Moving Average indicator.

**Example**

dema(close,21)

**See Also**

## Directional Movement Index

**Usage**

DX(N)

- n
- Number of periods.

**Description**

Calculates Wilder’s Directional Movement Index.

**Example**

dx(21)

**See Also**

## Directional Movement Rating

**Usage**

ADXR(N)

- n
- Number of periods.

**Description**

Calculates Wilder’s ADXR Directional Movement Rating.

**Example**

adxr(21)

**See Also**

## Ease Of Movement

**Usage**

EMV(N,METHOD)

- n
- Number of periods.
- method
- Moving average method.

**Description**

Calculates the Ease of Movement over n periods, using the moving average method given for *method*. Ease of Movement deals with relationship between volume and price changes.

## Forecast

**Usage**

FORECAST(EXPR,N,AHEAD)

- expr
- Data to evaluate.
- n
- Number of points used in linear regression.
- ahead
- Number of bars to look ahead.

**Description**

Performs an *n* tick linear regression over *expr*, and returns the forecasted value for *ahead* ticks into the future.

## Forecast Oscillator

**Usage**

FORECASTOSC(EXPR,N)

- expr
- Data to evaluate.
- n
- Number of bars.

**Description**

Calculates the Forecast Oscillator for *expr*, over *n* periods.

**Example**

forecastosc(CLOSE,21)

## Fractal Dimension

**Usage**

FRACTALDIM(EXPR,N)

- expr
- The data that will be interpreted. Eg: Close.
- n
- The number of periods sampled for each calculation.

**Description**

Approximates the fractal dimension of *expr* over the last *n*bars. Results will be between 1 and 2. The fractal dimension is a measure of randomness, where 1.5 is maximum randomness, and higher or lower values indicate order.

The Hurst exponent can be related to the fractal dimension as:

*Hursh exponent* = 2 – *fractal dimension*.

The algorithm used is based on the method described in “A procedure to Estimate the Fractal Dimension of Waveforms” by Carlos Sevcik, 1998.

**Example**

fractaldim(C,30)

## Hull ActTrade ROAR

**Usage**

HULLATROAR(CUTOFF,SLIQ,OLIQ)

- cutoff
- If the ROAR falls below this level, it will drop back to zero. Typically 80.
- sLiq
- Starting liquidity. The liquidity required to start the ROAR. Typically 3.5M.
- oLiq
- Ongoing liquidity. The liquidity required to sustain the ROAR. Typically 5M.

**Description**

HullAtROAR calculate Alan Hulls Active Trading Rate of Annual Return indicator. Note that there is no entry parameter for HullAtROAR. Refer to Alan Hull’s Active Trading course notes for more information.

**Example**

hullroar(80,3500000,5000000)

**See Also**

## Hull ActVest ROAR

**Usage**

HULLROAD(ENTRY,CUTOFF,SLIQ,OLIQ)

- entry
- The ROAD must fall below this level to start. Typically -30.
- cutoff
- If the ROAD rises above below this level, it will drop back to zero. Typically -20.
- sLiq
- Starting liquidity. The liquidity required to start the ROAD. Typically 12M.
- oLiq
- Ongoing liquidity. The liquidity required to sustain the ROAD. Typically 10M.

**Description**

HullROAD calculate Alan Hulls Active Investing Rate of Annual Decline indicator. Refer to Alan Hull’s Active Investing course notes for more information.

**Example**

hullroad(-30,-20,12000000,10000000)

**See Also**

## Hull ActVest ROAR

**Usage**

HULLROAR(ENTRY,CUTOFF,SLIQ,OLIQ)

- entry
- The ROAR must reach this level to start. Typically 30.
- cutoff
- If the ROAR falls below this level, it will drop back to zero. Typically 20.
- sLiq
- Starting liquidity. The liquidity required to start the ROAR. Typically 12M.
- oLiq
- Ongoing liquidity. The liquidity required to sustain the ROAR. Typically 10M.

**Description**

HullROAR calculate Alan Hulls Active Investing Rate of Annual Return indicator. Refer to Alan Hull’s Active Investing course notes for more information.

**Example**

hullroar(30,20,12000000,10000000)

**See Also**

## Inertia

**Usage**

INERTIA(N,SMOOTHING)

- n
- Number of periods.
- smoothing
- RVI periods.

**Description**

Calculates Donald Dorsey’s Inertia indicator over *n* periods, using the given smoothing.

## Intraday Momentum Index

**Usage**

IMI(N)

- n
- number of periods.

**Description**

Calculates the Intraday Momentum Index over *n* periods.

The Intraday Momentum Index (IMI) was developed by Tushar Chande. The calculation of the IMI is very similar to the RSI (Relative Strength Index), except it uses the relationship between the intraday opening and closing prices to determine whether the day is ‘up’ or ‘down.’ If the close is above the open, it is an up day. If the close is below the open it is a down day. Therein lies its tie to candlestick charting. For those familiar with candlestick charting, the IMI separates the black and white candlesticks and performs a RSI calculation on the candlestick bodies.

**Example**

imi(21)

**See Also**

## Keltner

**Usage**

KELTNERTOP(N) KELTNERBOT(N)

- n
- The number of periods used to calculate the bands.

**Description**

KeltnerTop and KeltnerBot calculate the top and bottom line respectively of the Keltner Channel, for the given number of periods.

The Keltner Channel indicator is used to identify overbought / oversold conditions as well as the trend strength of a market. When an asset’s price is closer to the upper band than the lower band, the market is considered overbought. Conversely, when an asset’s price is closer to the bottom band than the upper band, the market is considered oversold. An advantage of Keltner Channel analysis compared to other indicators used to analyze trend strength is that market lag is not as pronounced because Keltner Channels are extremely sensitive to fluctuations in volatility.

**Example**

keltnertop(10)

## Klinger Oscillator

**Usage**

KVO(N)

- n
- EMA signal periods.

**Description**

Calculates the Klinger Oscillator for the current bar. The Klinger Oscillator measures trends of money flows based upon volume.

## MACD

**Usage**

MACD()

**Description**

Calculates the MACD indicator. The MACD is approximately the difference between the 12 and 26 bar exponential moving averages. (The calculation of the moving averages is slightly non-standard).

**See Also**

## Market Facilitation Index

**Usage**

MARKETFACINDEX()

**Description**

Calculates the Market Facilitation Index according to the formula: (high – low)/volume

## Mass Index

**Usage**

MASS(N)

- n
- Number of periods.

**Description**

Calculates the Mass indicator over *n* periods.

The Mass index, described by Donald Dorsey, is developed to predict trend reversal by comparing difference and range between high and low prices. If the Mass index is going up, the range between high and low is bigger. If the Mass index is going down, the range between high and low is smaller.

**Example**

mass(21)

## Median Price

**Usage**

MP(N)

**Description**

Calculates the median price according to the formula: (high+low)/2. Importantly, this is not the same as the Statistical Median.

**See Also**

## MESA Adaptive Moving Average

**Usage**

MAMA()

**Description**

Calculates the MESA Adaptive Moving Average.

## Midpoint

**Usage**

MID(EXPR[,N])

**Description**

Calculates the midpoint of the range of *expr* over the last *n* bars, or over the entire dataset if *n* is not given.

**Example**

mid(CLOSE,21) will return the midpoint between the highest close and lowest close over the last 21 periods.

mid(CLOSE) will return the midpoint of the close price over the entire dataset.

**See Also**

Median Price | Statistical Median

## Minus Directional Movement (-DI)

**Usage**

MDI(N)

- n
- Number of periods.

**Description**

Calculates the Minus Directional Movement indicator over *n* periods.

**Example**

mdi(14)

**See Also**

## Momentum

**Usage**

MO(EXPR[,N])

- expr
- Momentum will be calculated over this data. Eg: Close.
- n
- Number of periods.

**Description**

Calculates the Momentum indicator over n periods according to the formula: (expr/hist(expr,n))*100

**Example**

mo(14)

## Money Flow Index

**Usage**

MFI(N)

- n
- Number of periods.

**Description**

Calculates the Money Flow Index over *n* periods.

The money flow indicator compares upward changes and downward changes of the volume weighted typical prices. This indicator is similar to the relative strength index, with the difference being the volume weighted prices.

**Example**

mfi(14)

**See Also**

Relative Strength Index | Relative Volatility Index | Typical price

## Moving Average

**Usage**

MA(EXPR,N[,METHOD])

- expr
- The data that will be averaged. Eg: Close.
- n
- The length of the moving average, specified in bars (ticks).
- method
- The type of the moving average (eg Simple). See the table below.

**Description**

Calculates an *n*-period moving average of *expr*, using the given moving average *method*. If *method* is not given, then a simple moving average will be calculated.

**Example**

ma(C,21,SIMPLE) will calculate a 21-period simple moving average of the close price.

Moving **Average** Methods

Either the keywords or abbreviations listed below may be used as a method. You can also get method as a parameter by using the InputMA function.

Keyword | Abbreviation | Description |
---|---|---|

`ELASTICVOLUMEWEIGHTED` |
`ELASTIC` |
Elastic Volume Weighted moving average. |

`ENDPOINT` |
`EP` |
End Point moving average. |

`EXPONENTIAL` |
`E` |
Exponential moving average. Strongest weighting is given to the last day bars, and decaying in an exponential fashion. |

`SIMPLE` |
`S` |
Simple moving average. Traditional moving average. Equal weighting is assigned to each tick. |

`TIMESERIES` |
`T` |
Time-Series moving average. A moving average based on linear regression. |

`TRIANGULAR` |
`TRI` |
Triangular moving average. Similar to running two identical simple moving averages over each other. |

`WEIGHTED` |
`W` |
Weighted moving average. |

`WILDERS` |
`WI` |
Wilder’s moving average. A form of exponential moving average used by Wilder to make calculating by-hand easier. |

`VARIABLE` |
`V` |
Variable moving average. |

`VOLUMEADJUSTED` |
`VOL` |
Volume-Adjusted moving average. |

`ZEROLAG` |
`ZERO` |
Zero-Lag moving average. |

**See Also**

## Negative Volume Index

**Usage**

NVI()

**Description**

Calculates the Negative Volume Index.

**See Also**

## On Balance Volume

**Usage**

OBV(EXPR)

- expr
- The data that will be examined for increases and decreases. Typically Close.

**Description**

Calculates the On Balance Volume indicator, using the specified data to determine movement.

On Balance Volume was one of the first volume indicators to measure positive and negative volume flows. Volume is added if *expr* moves up and subtracted if the *expr* price moves down. The On Balance Volume indicator was developed by Joseph Granville.

**Example **

obv(C)

## Parabolic SAR

**Usage**

SAR(STEP,MAXIMUM)

- step
- Rate of acceleration.
- maximum
- Maximum change per bar.

**Description**

Calculates Wilder’s Parabolic Stop and Reverse indicator.

**Example**

sar(0.01,0.25)

## Peak

**Usage**

PEAK(N,EXPR,CH)

- n
- The number of peaks ago.
- expr
- The data being processed.
- ch
- The % change required for the zig zag function.

**Description**

Returns the value of *expr* at *n* peaks ago, as determined by the Zig Zag function.

**Example**

peak(1,H,8) returns the value of High at the last peak on a 8% ZigZag on High.

**See Also**

PeakBars | Trough | TroughBars | ZigZag

## PeakBars

**Usage**

PEAKBARS(N,EXPR,CH)

- n
- The number of peaks ago.
- expr
- The data being processed.
- ch
- The % change required for the zig zag function.

**Description**

Returns the number of bars since the *n*th peak ago occured for *expr*, as determined by the Zig Zag function.

**Example**

peakbars(1,H,8) returns the number of bars since the last peak on a 8% ZigZag on High

**See Also**

Peak | Trough | TroughBars | ZigZag

## Performance

**Usage**

PER(EXPR)

- expr
- Performance will be calculated on this data.

**Description**

Calculates the performance of *expr* since the beginning of the dataset. The performance is the percentage that *expr* has changed since the beginning of the dataset.

**Example**

per(Close)

## Plus Directional Movement (+DI)

**Usage**

PDI(N)

- n
- Number of periods.

**Description**

Calculates the Plus Directional Movement indicator over *n* periods.

**Example**

pdi(14)

**See Also**

## Positive Volume Index

**Usage**

PVI()

**Description**

Calculates the Positive Volume Indicator.

**See Also**

## Price **Channel**

**Usage**

PRICECHANNELHIGH(N) PRICECHANNELLOW(N)

- n
- Number of bars used in calculation.

**Description**

PRICECHANNELHIGH and PRICECHANNELLOW calculate the top and bottom line of an n-period Price Channel indicator respectively. That is, the highest high and lowest low of the trailing n bars.

**Example**

pricechannelhigh(21)

pricechannellow(21)

## Price Oscillator

**Usage**

OSCP(N1,N2,METHOD,DIFFTYPE)

- n1
- Length of first moving average used in calculation.
- n2
- Length of first moving average used in calculation.
- method
- Type of moving average, such as exponential.
- difftype
- Points or percent.

### Description

The Price Oscillator calculates difference between two moving averages of length *n1* and *n2*, calculated using the *method* moving average method. The result is either given as a percent or as a value, depending on the value of *difftype* used.

**Example**

oscp(14,21,SIMPLE,POINTS)

**See Also**

InputROC | MACD | Volume Oscillator

## Price Volume Trend

**Usage**

PVT()

**Description**

Calculates the Price & Volume Trend indicator, which is the cumulative volume total, calculated using relative changes of the close price.

## Projection Band

**Usage**

PROJBANDTOP(N) PROJBANDBOT(N)

- n
- Number of periods used in calculation.

**Description**

PROJBANDTOP and PROJBANDBOT calculates the top and bottom of the *n*-period projection band respectively.

Projection Bands are calculated by finding the minimum and maximum prices over the specified number of days and projecting these forward. The results consists of two bands representing the minimum and maximum price boundaries. Prices will always be contained by the bands, unlike Bollinger Bands.

**Example**

projbandtop(21)

projbandbot(21)

**See Also**

## Projection Oscillator

**Usage**

PROJOSC(N,SMOOTHING)

- n
- Number of periods used in initial calculation.
- smoothing
- Number of days used in smoothing average.

**Description**

Calculates the Projection Oscillator for *n* periods, with the specified *smoothing*. The Projection Oscillator shows where the current price is relative to the Projection bands.

**See Also**

## Qstick

**Usage**

QSTICK(N,METHOD)

- n
- Number of periods used in calculation.
- method
- Moving average method

**Description**

Calculates the Q-Stick indicator. Developed by Tushar Chande as a way to quantify candlesticks, the QStick indicator is a moving average of the difference between the opening and closing prices of an issue.

The formula used to calculate Q-Stick is: ma(close-open,n,method)

**Example**

qstick(21)

## Rally

**Usage**

RALLY()

**Description**

Returns 1 when the current bar rallies from the previous one, and a 0 otherwise. A bar rallies when its high price is greater than the previous bar’s high price, and its low price is greater than or equal to the previous bar’s low price.

## Rally with Volume

**Usage**

RALLYWITHVOL()

Description

Returns 1 when the current bar rallies with volume from the previous one, and a 0 otherwise. A bar rallies with volume if it rallies, and its volume is higher than for the previous bar.

## Random Walk Index

**Usage**

RWI()

**Description**

Michael Poulos developed the Random Walk Index in an effort to find an indicator that overcomes the effects of a fixed look-back period and the drawbacks of traditional smoothing methods.

The Random Walk Index is based on the basic geometric concept that the shortest distance between two points is a straight line. The further prices stray from a straight line during a move between two points in time, the less efficient the movement.

## Range Indicator

**Usage**

RANGEINDICATOR(N,SMOOTHING)

**Description**

Calculates the Range Indicator, developed by Jack Weinberg, over *n* periods, with the specified smoothing.

**Example**

rangeindicator(21,4)

## Rate of Change

**Usage**

ROC(EXPR,N,DIFFMETHOD)

- expr
- Input data used in calculation.
- n
- Number of periods used in calculation.
- diffmethod
- Either points or percent.

**Description**

Calculates the rate of change of expr at the current bar to what it was *n* bars ago. *Diffmethod* maybe percent, in which case the difference will be a percentage, or points in which case the difference will be the number of points moved.

**Example**

roc(CLOSE,14,POINTS)

**See Also**

## Reaction

**Usage**

REACTION()

**Description**

Returns 1 when the current bar is in reaction from the previous one, and a 0 otherwise. A bar is in reaction when its high price is less than or equal to the previous bar’s high price, and its low price is less than the previous bar’s low price.

## Reaction with Volume

**Usage**

REACTIONWITHVOL()

Description

Returns 1 when the current bar is in reaction with volume from the previous one, and a 0 otherwise. A bar is in reaction with volume when it is in reaction, and the current bar�s volume is greater than the previous bar�s volume.

## Relative Strength Index

**Usage**

RSI(N)

- n
- Number of periods used in calculation.

**Description**

Calculates the Relative Strength Index for *n* periods.

The Relative Strength index was developed by J. Welles Wilder. It is a momentum oscillator that compares upward movements of the close price with downward movements, resulting in a value which ranges between 0 and 100.

**Example**

rsi(21)

**See Also**

Money Flow Index | Relative Volatility Index

## R-Squared Indicator

**Usage**

RSQUARED(EXPR,N)

- expr
- Input data used in calculation.
- n
- Number of bars used in calculation.

**Description**

Calculated the R-Squared indicator over *expr*.

**Example**

rsquared(CLOSE,14)

## Stochastic Momentum

**Usage**

STOCHMOMENTUM(KPERIODS,SMOOTHING,DOUBLESMOOTHING,DPERIODS,METHOD)

- kperiods
- %K Time periods
- smoothing
- %K Smoothing period
- doublesmoothing
- %K Double smoothing
- dperiods
- %D Time periods
- method
- %D Moving Average Method

**Description**

Calculates the Stochastic Momentum for *expr* using the given settings.

The Stochastic Oscillator provides you with a value showing the distance the current close is relative to the recent n-period high/low range, the SMI shows you where the C is relative to the midpoint of the recent n-period high/low range. The result is an oscillator that ranges between +/- 100 and is a bit less erratic than an equal period Stochastic Oscillator.

**Example**

stochmomentum(5,3,3,3,SIMPLE)

**See Also**

## Stochastic Oscillator

**Usage**

STOCH(N,SLOWING)

- n
- Number of periods used in the main calculation.
- slowing
- Number of periods used in the ‘slowing’ smoothing average.

**Description**

Calculates the Stochastic Oscillator over *n* periods, using the given number of periods *slowing*.

**Example**

stoch(8,5)

**See Also**

## Swing Index

**Usage**

SWING(LIMIT)

- limit
- Limit of movement.

**Description**

Calculates the Swing Index indicator with the given *limit* of movement.

This indicator assigns a Swing Index value from 0 to 100 for an up bar and 0 to -100 for a down bar. This indicator uses the current bar’s open, high,low and close as well as the previous bar’s open and close to calculate the Swing Index values.

**Example**

swing(7.5)

**See Also**

## TEMA

**Usage**

TEMA(EXPR,N)

- expr
- Input data used in calculation.
- n
- Number of periods used in calculation.

**Description**

Calculates the TEMA indicator for *expr* over the last *n* periods. TEMA is a composite of a single, double, and triple exponential moving average.

**Example**

tema(close,14)

**See Also**

## Time Series Forecast

**Usage**

TSF(EXPR,N)

- expr
- Input data used in calculation.
- n
- Number of periods used in calculation.

**Description**

Calculates the *n*-period time series forecast of *expr*.

**Example**

tsf(close,14)

## TRIX

**Usage**

TRIX(N)

- n
- Number of periods used in calculation.

**Description**

Calculates the *n*-period TRIX indicator.

**Example**

trix(14)

## Trough

**Usage**

TROUGH(N,EXPR,CH)

- n
- The number of troughs ago.
- expr
- The data being processed.
- ch
- The % change required for the zig zag function.

**Description**

Returns the value of *expr* at *n* troughs ago, as determined by the Zig Zag function.

**Example**

trough(1,L,8) returns the value of Low at the last trough on a 8% ZigZag on Low.

**See Also**

Peak | PeakBars | TroughBars | ZigZag

## TroughBars

**Usage**

TROUGHBARS(N,EXPR,CH)

- n
- The number of troughs ago.
- expr
- The data being processed.
- ch
- The % change required for the zig zag function.

**Description**

Returns the number of bars since the *n*th trough ago occured for *expr*, as determined by the Zig Zag function.

**Example**

troughbars(1,L,8) returns the number of bars since the last trough on a 8% ZigZag on Low.

**See Also**

Peak | PeakBars | Trough | ZigZag

## True Range

**Usage**

TR

**Description**

The TR function calculates the True Range of the current bar.

True Range is a measurement of range developed by Welles Wilder to take into account gaps between bars. The range is normally considered to be the difference between the high price and the low price, but Wilder determined that an overnight move price should also be considered.

The true range is calculated as follows:

- Calculate the absolute difference between the current high and the current low price
- Calculate the absolute difference between the current high and the previous close price
- Calculate the absolute difference between the current low and the previous close price
- The largest of these three values is the True Range

**Example**

{A crude stop drawn one True Range below the low price}

[target=Price]

Low – TR;

**See Also**

## Typical Price

**Usage**

TYPICAL()

- n
- Number of periods used in calculation.

**Description**

Calculates the typical price, according to the formula: (High + Low + Close)/3

## Ultimate Oscillator

**Usage**

ULTIMATE(N1,N2,N3)

- n1
- First cycle length.
- n2
- Second cycle length.
- n3
- Third cycle length.

**Description**

Calculates the Ultimate Oscillator, using *n1*, *n2*, and *n3* as cycle lengths.

The ultimate oscillator calculates the sums of the True Ranges of the number of bars specified by the inputs *n1*, *n2*, and *n3*. These sums are divided into the sums of the distance from the close to the low. This value is weighted for the three lengths to give the final result.

## Vertical Horizontal Filter

**Usage**

VHF()

**Description**

Calculates the Vertical Horizontal Filter indicator.

## Volatility

**Usage**

VOL([MAPERIODS,ROCPERIODS])

- maperiods
- Moving average periods.
- rocperiods
- Rate of change periods.

**Description**

Calculates Chaikin’s Volatility indicator, using the given number of moving average periods, and the given number of periods for the rate of change. *Maperiods* and *rocperiods* are each set to 10 if they are not given.

The Volatility Chaikins indicator measures the difference between high and low prices. This formula is used to indicate the top or bottom of the market. This formula was developed by Marc Chaikin.

**Example**

vol(15,20)

## Volume Oscillator

**Usage**

OSCV(N1,N2,METHOD,DIFFTYPE)

- n1
- Length of first moving average used in calculation.
- n2
- Length of first moving average used in calculation.
- method
- Type of moving average, such as exponential.
- difftype
- Points or percent.

**Description**

Calculates the volume oscillator, using *n1* and *n2* length moving averages, calculated using the *method* moving average method, with the given difference calculation type used.

**Example**

oscv(14,21,SIMPLE,POINTS)

**See Also**

## Weighted Close

**Usage**

WC()

**Description**

Calculated the Weighted Close indicator according to the formula: (close*2 + high + low)/4

## Wilder’s Smoothing

**Usage**

WILDERS(EXPR,N)

- expr
- Data to be smoothed.
- n
- Smoothing periods.

**Description**

Smooths *expr* using Wilder’s Smoothing indicator over *n* periods.

**Example**

wilders(CLOSE,14)

## Williams’ %R

**Usage**

WILLR(N)

- n
- Number of periods.

**Description**

Calculates Williams’ %R indicator over *n* periods.

**Example**

willr(14)

## Williams’ A/D

**Usage**

WILLA

**Description**

Calculates Williams’ A/D indicator.

## ZigZag

**Usage**

ZIGZAG(EXPR,CH,METHOD)

- expr
- The data being processed. Eg: Close.
- ch
- Minimum reversal amount.
- method
- Reversal method. Points or Percent.

**Description**

Calculates the ZigZag indicator for the data given in *expr*.

**Example**

zigzag(C,10,%)

**See Also**