Stock Screener – Example 7: Single Parameter Multiple Inputs (Weekly Price Performance)

This is an example of an optimized scan (weekly price performance) that can replace the need for writing several scans (as was required in the older versions of ChartAlert); this functionality for the Advanced Scanner will be introduced in October 2023

3 minutes

This functionality will be introduced in October 2023 (Version 23.10.1)

Below is an illustration of an optimized scan that can be created using the Advanced Scanner in ChartAlert.

This one enhanced scan, wherein a single parameter or variable can now accept multiple values or inputs for scanning, now replaces the need for writing five separate scans as was required in the previous versions of ChartAlert.

[BEGIN timep-wk PP >5%]

Set OptVar timep = 1,2,4,6,8 

List symbols where Chg%(cl, cl timep weeks ago) > 5

Add Column Chg%(cl, cl timep weeks ago) as chg% 

Apply to NIFTY


Below is a breakdown of the scan presented in a step-by-step manner.

Purpose of the Scan

  1. To generate a list of symbols where the latest Close, when compared to the Close n-weeks ago, has gained by more than 5%; here, “n-weeks” stands for 1-week, 2-weeks, 4-weeks, 6-weeks and 8-weeks.
  2. To display the percentage change of the latest Close with respect to the Close n-weeks ago.
  3. To scan the components of the following index: NIFTY.

Let’s go!

Line 1

[BEGIN timep-wk PP >5%]

The optimized scan procedure starts with a “BEGIN” command.

The text “timep-wk PP >5%” that comes after the “BEGIN” command serves as the designated heading for the scan results that will be showcased in the scan report.

“timep-wk PP >5%” is designed to work like this: 2-wk PP >5%

Line 2

Set OptVar timep = 1,2,4,6,8

We are configuring or setting an optimized variable (“Set OptVar”) that will be referred to as “timep”.

The term “timep” functions as a temporary marker or placeholder within the scan heading and will be substituted with terms like “1,” “2,” “4,” “6” or “8” in the scan report.

You can customize the term “timep” with anything of your choosing . . . Just remember to globally replace the term “timep” with (say) “TP” in the scan, and the scan results will still be the same.

See Line 3 below to know more on how “timep” gets used in the scan.

Line 3

List symbols where Chg%(cl, cl timep weeks ago) > 5

This scan (“Chg%(cl, cl timep weeks ago) > 5”) will generate a list of symbols where the change in close (“cl”) over the past several weeks (“cl timep weeks ago”) in percentage terms is above 5 percent.

The parameter or variable “timep” will encompass five settings that will be used to compute the percentage change in the scan: 1, 2, 4, 6 and 8.

In essence, upon execution, this scanning process will use “1-wk,” “2-wk,” “4-wk,” “6-wk” and “8-wk” as input to look for symbols where this specific condition has been met.

Line 4

Add Column Chg%(cl, cl timep weeks ago) as chg%

In this scan, the function “Add Column…” serves the purpose of displaying additional columns within a scan report.

In this case, the scanning report will display one column: the change in close over the past several weeks in percentage terms.

The column will be titled “chg%”, wherein “timep” will be substituted with the five time periods.

Line 5

Apply to NIFTY

The “Apply to…” function applies the scanning process to the NIFTY Index, and the scan will effectively examine all the constituent elements of NIFTY.

Line 6


The optimized scan code concludes with an “END” statement.

The Scan Report in ChartAlert

%d bloggers like this: