Technical Functions

Technical Functions

Scan Syntax Reference: Technical Functions

There are several arithmetic functions that you can you can use to modify the expressions in your scan. For more information on writing scans using these and other types of scan syntax, please see our Support Center article on Writing Scans.

Absolute Value (AbsVal)

The Absolute Value of the expression.

Syntax:

  • AbsVal(exp)

Parameters:

  • exp - expression

Example:

  • [AbsVal(MACD Hist(12,26,9)) > 3]

Count Down

The number of periods in the specified timeframe where the value has decreased for the given expression such as “close”, “volume”, or “rsi(14)”.

Syntax:

  • [Count Down(nPeriods, exp)]

Parameters:

  • nPeriods - Number of periods in the timeframe
  • exp - The values to be used in the calculation. The default is Close.

Operators:

  • =, !=, >, >=, ⇐, <, x, is, is not

Example:

  • [Count Down(20, close) > 10]

Count Up

The number of periods in the specified timeframe where the value has increased for the given expression such as “close”, “volume”, or “rsi(14)”.

Syntax:

  • [Count Up(nPeriods, exp)]

Parameters:

  • nPeriods - Number of periods in the timeframe
  • exp - The values to be used in the calculation. The default is Close.

Operators:

  • =, !=, >, >=, ⇐, <, x, is, is not

Example:

  • [Count Up(20, close) > 10]

Maximum Value (Max)

The highest value of the expression over the specified time period. See our Support Center article on Writing Min/Max Scans for more information.

Syntax:

  • Max(nPeriod, exp)

Parameters:

  • nPeriod - Number of periods
  • exp - expression

Example:

  • [Max(253,close) > 99.9]

Minimum Value (Min)

The lowest value of the expression over the specified time period. See our Support Center article on Writing Min/Max Scans for more information.

Syntax:

  • Min(nPeriod, exp)

Parameters:

  • nPeriod - Number of periods
  • exp - expression

Example:

  • [Min(253,close) < 99.9]

Percent Change (PctChange)

The percentage change of the expression over the specified time period. See our Support Center article on Writing Percent Change Scans for more information.

Syntax:

  • PctChange(nPeriod, exp)

Parameters:

  • nPeriod - Number of periods
  • exp - expression

Example:

  • [PctChange(10,close) > 15]

Percent Diff (PctDiff)

The percentage difference between two expressions.

Syntax:

  • PctDiff(exp1, exp2)

Parameters:

  • exp1 - first expression
  • exp2 - second expression

Example:

  • [PctDiff(close,sma(50,close)) < 5]

Percent Relative (PctRelative)

The difference between the security's Percent Change (PctChange) value and the PctChange value of the specified symbol.

Syntax:

  • [PctRelative(nPeriods, symbol, exp)]

Parameters:

  • nPeriods - Number of periods
  • symbol - The symbol to compare with when calculating the difference in PctChange values. Note that in place of an actual symbol, the pseudo-symbols $sector and $industry can also be used to find stocks that are outperforming their sector or industry.
  • exp - (optional) The values to be used in the Percent Relative calculation. The default is Close.

Operators:

  • =, !=, >, >=, ⇐, <, x, is, is not

Example:

  • [PctRelative(20,$spx) > 0]
  • [PctRelative(20,$sector) > 10]

Streak Down

The number of periods in a row where the value has decreased for the given expression such as “close”, “volume”, or “rsi(14)”.

Syntax:

  • [Streak Down(exp)]

Parameters:

  • exp - The values to be used in the streak calculation. The default is Close.

Operators:

  • =, !=, >, >=, ⇐, <, x, is, is not

Example:

  • [Streak Down(close) > 1]

Streak Up

The number of periods in a row where the value has increased for the given expression such as “close”, “volume”, or “rsi(14)”.

Syntax:

  • [Streak Up(exp)]

Parameters:

  • exp - The values to be used in the streak calculation. The default is Close.

Operators:

  • =, !=, >, >=, ⇐, <, x, is, is not

Example:

  • [Streak Up(close) > 1]