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, wherein a single parameter or variable can now accept multiple values or inputs for scanning, now replaces the need for writing six separate scans as was required in the previous versions of ChartAlert.
[BEGIN Close crossed above EMA(timeP1)] Set OptVar timeP1 = 5,8,13,21,34,55 List symbols where c crossed above EMA(timeP1) Add Column Close Add Column EMA(timeP1) chart(color=red, lw=2) Apply to Nifty100 [END]
Below is a breakdown of the scan presented in a step-by-step manner.
Purpose of the Scan
- To generate a list of symbols where the latest Close has just crossed above several EMAs (Exponential Moving Average); for example: EMA(5), EMA(8), EMA(13), EMA(21), EMA(34) and EMA(55).
- To display the values of the latest Close and the various EMAs in the scan results report.
- To plot the EMA on the chart if a symbol is opened from inside the scan results report.
- To scan the components of the following index: Nifty100.
[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 “5,” “8,” “13,” “21,” “34” or “55” 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(55)
Set OptVar timeP1 = 5,8,13,21,34,55
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.
This parameter or variable “timeP1” will encompass six indicator settings (number of trading bars) that will be used to compute the Exponential Moving Average (EMA): “5,” “8,” “13,” “21,” “34” and “55”.
In essence, upon execution, this scanning process will sequentially compute the EMA as follows: EMA(5), EMA(8), EMA(13), EMA(21), EMA(34) and EMA(55).
List symbols where c crossed above EMA(timeP1)
This scan will generate a list of symbols where the value of “c” (representing the current Close) has recently crossed above “EMA(timeP1)”.
The scan will use EMA(5), EMA(8), EMA(13), EMA(21), EMA(34) and EMA(55) 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 six variable time periods (5, 8, 13, 21, 34 and 55) 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 six 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).
Apply to Nifty100
The “Apply to…” function applies the scanning process to the NIFTY100 Index, and the scan will effectively examine all the constituent elements of NIFTY100.
The optimized scan code concludes with an “END” statement.