Stock Screener – Example 1: Multiple Segments (“Apply to…”)

This is an example of an optimized scan that demonstrates the enhanced “Apply to…” function; it can replace the need for writing several scans (as was required in the older versions of ChartAlert); this functionality for the Advanced Scanner is being introduced in September 2023

3 minutes

This functionality will be introduced in September 2023 (Version 23.9.1)

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

This one enhanced scan now replaces the need for writing four separate scans as was required in the previous versions of ChartAlert.

[BEGIN close>superT(10,3) - IndexNames]

Set OptVar IndexNames = Nifty, Nifty100, Nifty200, Nifty500

List symbols where c crossed above supertrend(10,3)

Add Column Close
Add Column SUPERTREND(10,3) chart

Apply to IndexNames

[END]

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 has just crossed above the SuperTrend indicator.
  2. To display the values of the latest Close and the SuperTrend indicator in the scan results report.
  3. To scan the components of the following indices: Nifty, Nifty100, Nifty200 and Nifty500, although Nifty, Nifty100 and Nifty200 are subsets of Nifty500.

Let’s go!


Line 1

[BEGIN close>superT(10,3) - IndexNames]

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

The text “close>superT(10,3) – IndexNames” that comes after the “BEGIN” command serves as the designated heading for the scan results that will be showcased in the scan report.

The term “IndexNames” functions as a temporary marker or placeholder within the scan heading and will be substituted with terms like “Nifty,” “Nifty100,” “Nifty200,” or “Nifty500” in the scan report.

You can customize the term “IndexNames” with anything of your choosing.

“close>superT(10,3) – IndexNames” is designed to work like this: close>superT(10,3) – Nifty500


Line 2

Set OptVar IndexNames = Nifty, Nifty100, Nifty200, Nifty500

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

Remember, you can customize the term “IndexNames” with anything of your choosing.

This variable “IndexNames” will encompass four distinct segments, namely “Nifty,” “Nifty100,” “Nifty200” and “Nifty500”.

In essence, upon execution, this scanning process will sequentially navigate through these four segments: Nifty, Nifty100, Nifty200 and Nifty500.


Line 3

List symbols where c crossed above supertrend(10,3)

This scan will generate a list of symbols where the value of “c” (representing the current Close) has recently crossed above the “supertrend(10,3)” threshold.

The scan will navigate across the four mentioned segments (Nifty, Nifty100, Nifty200 and Nifty500) looking for symbols where this specific condition has been met.

Here, “supertrend(10,3)” refers to the SuperTrend indicator with a setting of 10-bars and a multiplier of 3.


Line 4 and 5

Add Column Close
Add Column SUPERTREND(10,3) chart

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 two columns: the latest closing value, and the latest value of the SuperTrend indicator.

These columns will be titled “Close” and “SUPERTREND(10,3)”, respectively.

The function “chart” will simply plot the mentioned indicator on the chart of the resultant symbol in ChartAlert.


Line 6

Apply to IndexNames

The “Apply to…” function applies the scanning process to the variable “IndexNames”.

As mentioned earlier, “IndexNames” represents an optimized variable, and is designed to indicate 4 main segments, namely Nifty, Nifty100, Nifty200, and Nifty500.

In other words, the scan will effectively examine all constituent elements within the Nifty, Nifty100, Nifty200, and Nifty500 Indices.


Line 7

[END]

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


The Scan Report in ChartAlert

%d bloggers like this: