Stock Screener – Example 6: Single Parameter Multiple Inputs; Summary Report (“Set report type to…”)

This is an example of an optimized scan wherein a single parameter or variable can accept multiple inputs thereby replacing the need for writing several scans (as was required in the older versions of ChartAlert); it also demonstrates the enhanced “Set report type to…” function; this functionality will be introduced in October 2023

4 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.


ATTN: This scan is similar to the earlier scan (refer to Example 5: Single Parameter Multiple Inputs), with the exception of the final line (“Set report type to SUMMARY”).


[BEGIN Close crossed above EMA(timeP1)]

Set OptVar timeP1 = 30, 50, 100, 150, 200

List symbols where Close crossed above EMA(timeP1)

Add Column Close
Add Column EMA(timeP1) chart(color=red, lw=2)

Apply to NIFTYTOTAL

[END]

Set report type to SUMMARY

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 various EMAs (Exponential Moving Average); for example: EMA(30), EMA(50), EMA(100), EMA(150) and EMA(200).
  2. To display the values of the latest Close and the various EMAs in the scan results report.
  3. To plot the EMA on the chart if a symbol is opened from inside the scan results report.
  4. To scan the components of the following index: NIFTYTOTAL.
  5. To list the scan results as a summary report: the scan output will be listed as the number of qualifying symbols under each NSE Index available in ChartAlert.

Let’s go!


Line 1

[BEGIN Close crossed above EMA(timeP1)]

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

The text “Close crossed above EMA(timeP1)” 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 “timeP1” functions as a temporary marker or placeholder within the scan heading and will be substituted with terms like “30,” “50,” “100,” “150” or “200” in the scan report.

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

“Close crossed above EMA(timeP1)” is designed to work like this: Close crossed above EMA(30)


Line 2

Set OptVar timeP1 = 30, 50, 100, 150, 200

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

Remember, you can customize the term “timeP1” (time period) with anything of your choosing . . . For example, you can globally replace the term “timeP1” with (say) “TP” in the scan, and the scan results will still be the same.

This parameter or variable “timeP1” will encompass five indicator settings (number of trading bars) that will be used to compute the Exponential Moving Average (EMA): “30,” “50,” “100,” “150” and “200” .

In essence, upon execution, this scanning process will sequentially compute the EMA as follows: EMA(30), EMA(50), EMA(100), EMA(150) and EMA(200).


Line 3

List symbols where Close crossed above EMA(timeP1)

This scan will generate a list of symbols where the the current “Close” has recently crossed above “EMA(timeP1)” .

The scan will use EMA(30), EMA(50), EMA(100), EMA(150) and EMA(200) as input to look for symbols where this specific condition has been met.

Here, “EMA” refers to Exponential Moving Average, and “timeP1” refers to the five variable time periods (30, 50, 100, 150 and 200) as mentioned above.


Line 4 and 5

Add Column Close
Add Column EMA(timeP1) chart(color=red, lw=2)

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 values of the EMA.

These columns will be titled “Close” and “EMA(timeP1)” , respectively, wherein “timeP1” will be substituted with the five time periods.

The function “chart(color=red, lw=2)” will simply plot the moving average on the chart of the resultant symbol in ChartAlert, and the color and the line width of the moving average would be set to “red” and at “2” pixels (respectively).


Line 6

Apply to NIFTYTOTAL

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


Line 7

[END]

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


Line 8

Set report type to SUMMARY

The functionality labeled as “Set report type to…” empowers users to determine the manner in which the scan results will be showcased.

Choosing the “SUMMARY” option presents the scan results in a summarized/ concise report format.

This SUMMARY report categorizes and lists the eligible “number of symbols” under each official NSE Index present in ChartAlert . . . If you wish to explore further, you can click on the mentioned “number of symbols” to view the specific list of symbols identified by that NSE Index.


The Scan Report in ChartAlert

%d bloggers like this: