> For the complete documentation index, see [llms.txt](https://help.stockcharts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.stockcharts.com/scanning-and-alerts/scan-writing-resource-center/scan-syntax-reference/scan-syntax-technical-functions.md).

# Scan Syntax: Technical Functions

There are several arithmetic functions that 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](/scanning-and-alerts/scan-writing-resource-center/writing-scans.md).

## Absolute Value (AbsVal) <a href="#absolute_value_absval" id="absolute_value_absval"></a>

The Absolute Value of the expression.

**Syntax:**

* AbsVal(exp)

**Parameters:**

* exp - expression

**Example:**

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

## Count Down <a href="#count_down" id="count_down"></a>

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 - Values to be used in the calculation; default is Close

**Operators:**

* \=, !=, >, >=, ⇐, <, x, is, is not

**Example:**

* \[Count Down(20, close) > 10]

## Count Up <a href="#count_up" id="count_up"></a>

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) <a href="#maximum_value_max" id="maximum_value_max"></a>

The highest value of the expression over the specified time period. See our Support Center article on [Writing Min/Max Scans](/scanning-and-alerts/scan-writing-resource-center/scanning-case-studies/writing-min-max-scans.md) for more information.

**Syntax:**

* Max(nPeriod, exp)

**Parameters:**

* nPeriod - Number of periods
* exp - expression

**Example:**

* \[Max(253,close) > 99.9]

## Minimum Value (Min) <a href="#minimum_value_min" id="minimum_value_min"></a>

The lowest value of the expression over the specified time period. See our Support Center article on [Writing Min/Max Scans](/scanning-and-alerts/scan-writing-resource-center/scanning-case-studies/writing-min-max-scans.md) for more information.

**Syntax:**

* Min(nPeriod, exp)

**Parameters:**

* nPeriod - Number of periods
* exp - expression

**Example:**

* \[Min(253,close) < 99.9]

## Percent Change (PctChange) <a href="#percent_change_pctchange" id="percent_change_pctchange"></a>

The percentage change of the expression over the specified period. See our Support Center article on [Writing Percent Change Scans](/scanning-and-alerts/scan-writing-resource-center/scanning-case-studies/writing-percent-change-scans.md) for more information.

**Syntax:**

* PctChange(nPeriod, exp)

**Parameters:**

* nPeriod - Number of periods
* exp - expression

**Example:**

* \[PctChange(10,close) > 15]

## Percent Diff (PctDiff) <a href="#percent_diff_pctdiff" id="percent_diff_pctdiff"></a>

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) <a href="#percent_relative_pctrelative" id="percent_relative_pctrelative"></a>

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 - Values to be used in the calculation; default is Close

**Operators:**

* \=, !=, >, >=, ⇐, <, x, is, is not

**Example:**

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

## Streak Down <a href="#streak_down" id="streak_down"></a>

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 - Values to be used in the calculation; default is Close

**Operators:**

* \=, !=, >, >=, ⇐, <, x, is, is not

**Example:**

* \[Streak Down(close) > 1]

## Streak Up <a href="#streak_up" id="streak_up"></a>

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 - Values to be used in the calculation; default is Close

**Operators:**

* \=, !=, >, >=, ⇐, <, x, is, is not

**Example:**

* \[Streak Up(close) > 1]


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.stockcharts.com/scanning-and-alerts/scan-writing-resource-center/scan-syntax-reference/scan-syntax-technical-functions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
