ATTN: This scan is an extension of an earlier scan (refer to Example 22: Define a time frame and classify the daily % fluctuations in closing prices within that timeframe into ‘n’ distinct categories), with the exception of extracting a few more data points in this scan.
List data from "01-Sep-2023"
Add col MARKET_COUNT(chg%<=-4) as Chg <-4% format 0
Add col MARKET_COUNT(chg%<0 and chg%>-4) as Chg 0 To -4% format 0
Add col MARKET_COUNT(chg%>0 and chg%<4) as Chg 0 to 4% format 0
Add col MARKET_COUNT(chg%>=4) as Chg >4% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago) >= 25) as MChg >25% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago)<= -25) as MChg <-25% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago) >= 50) as MChg >50% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago)<= -50) as MChg <-50% format 0
Add col MARKET_COUNT(chg%(cl, cl 34 bars ago) >= 13) as 34BChg >13% format 0
Add col MARKET_COUNT(chg%(cl, cl 34 bars ago)<= -13) as 34BChg <-13% format 0
Add col MARKET_COUNT(chg%(cl, cl a quarter ago) >= 25) as QChg >25% format 0
Add col MARKET_COUNT(chg%(cl, cl a quarter ago)<= -25) as QChg <-25% format 0
Add Column chg%
Add Column chg%(cl, cl a month ago) as MChg
Add Column chg%(cl, cl 34 bars ago) as 34BChg
Add Column chg%(cl, cl a quarter ago) as QChg
Apply to niftymic250
Set report type to SUMMARY-DATEWISE
Below is a breakdown of the scan presented in a step-by-step manner.
Purpose of the Scan
- The purpose of this scan is to analyze a list of symbols over a defined time period, say, from 01-Sep-2023 till today.
- We will categorize the daily percentage changes in closing prices into four groups:
- “less than or equal to -4%”
- “between 0% and -4%”
- “between 0% and 4%”
- “greater than 4%”
- We’ll then count how many symbols fall into each of these groups and express this count as a raw number relative to the total number of symbols.
- Next, we’ll calculate and categorize the percentage changes in closing prices over the last month into four groups:
- “less than -25%”
- “greater than 25%”
- “less than -50%”
- “greater than 50%”
- Similarly, we’ll count the symbols in each of these categories and present these counts relative to the total number of symbols.
- We’ll then compute and categorize the percentage changes in closing prices over the last 34 trading bars into two groups, and again, provide counts relative to the total number of symbols:
- “less than -13%”
- “greater than 13%”
- Following that, we will compute and categorize the percentage changes in closing prices over the last quarter into two groups, and provide counts relative to the total number of symbols:
- “less than -25%”
- “greater than 25%”
- Additionally, we will extract and display the actual percentage changes in closing prices for each day within the specified time frame. We will do the same for the percentage changes over the last month, the last 34 trading bars, and the last quarter within the specified time frame.
- Ultimately, we will present the results of this scan in a summary report, organized by date. Users will also have the option to access more detailed information about the scan results, on demand.
- This entire process will be applied to the components of the NIFTYMIC250 index.
Let’s go!
Line 1
List data from "01-Sep-2023"
The “List data” function permits users to retrieve historical information about symbols within a chosen group or portfolio for particular dates. In this scan code, our aim is to gather data commencing from September 1, 2023, indicated as “from “01-Sep-2023””.
Lines 2 through 5
Add col MARKET_COUNT(chg%<=-4) as Chg <-4% format 0
Add col MARKET_COUNT(chg%<0 and chg%>-4) as Chg 0 To -4% format 0
Add col MARKET_COUNT(chg%>0 and chg%<4) as Chg 0 to 4% format 0
Add col MARKET_COUNT(chg%>=4) as Chg >4% format 0
The “Add col…” function, also called “Add Column…”, is a function used to provide extra information in a scan results report.
In our recently updated Advanced Scanner, we’ve introduced a new feature known as “MARKET_COUNT()”.
The “MARKET_COUNT()” function helps in calculating various factors across an entire market. In simpler terms, it scans and keeps track of different aspects throughout the market.
In this specific scan code, the initial column, named “Chg <=-4%”, will calculate and display the number of symbols where the closing prices have fallen by more than 4% (“MARKET_COUNT(chg%<=-4)”) for the current day.
The second column, named “Chg 0 To -4%”, calculates and displays the count of symbols where the closing prices have fallen within the range of 0% to 4% (“MARKET_COUNT(chg%<0 and chg%>-4)”) for the day.
The third column, titled “Chg 0 to 4%”, counts and displays how many symbols had their closing prices increase by 0% to 4% (“MARKET_COUNT(chg%>0 and chg%<4)”) during the day.
The last column, titled “Chg >4%”, counts and displays the number of symbols that had their closing prices increase by more than 4% (“MARKET_COUNT(chg%>=4)”) for the day.
You have the flexibility to customize all of the column titles mentioned above according to your preferences. It’s important to ensure that you maintain consistent naming convention throughout the scan in order for the scan code to function correctly.
Line 6 and 7
Add col MARKET_COUNT(chg%(cl, cl a month ago) >= 25) as MChg >25% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago)<= -25) as MChg <-25% format 0
In this scan, we’re using a specific “chg%(cl, cl a month ago)” function to determine how much the value of different symbols has changed over the past month.
We have two ways of asking the scan for information:
- one is to look for symbols where their value has gone up by more than 25% in the past month “chg%(cl, cl a month ago) >= 25”
- the other is to find symbols where their value has dropped by more than 25% in the same timeframe “chg%(cl, cl a month ago)<= -25”
Any symbols that don’t meet these two conditions won’t show up in the results of the scan.
The first column in the scan code, which is named “MChg >25%”, calculates and displays the number of symbols whose closing prices have gone up by more than 25% in the past month (“MARKET_COUNT(chg%(cl, cl a month ago) >= 25)”).
The second column, called “MChg <-25%”, calculates and displays the number of symbols whose closing prices have gone down by more than 25% in the past month (“MARKET_COUNT(chg%(cl, cl a month ago)<= -25)”).
You can change the names of these columns as you prefer, but it’s important to keep their names consistent for the scan to work properly.
Line 8 and 9
Add col MARKET_COUNT(chg%(cl, cl a month ago) >= 50) as MChg >50% format 0
Add col MARKET_COUNT(chg%(cl, cl a month ago)<= -50) as MChg <-50% format 0
In this scan, we’re using two queries, namely “chg%(cl, cl a month ago) >= 50” and “chg%(cl, cl a month ago)<= -50”, to determine if a symbol’s value has gained by more than 50% or fallen by more than 50% over the last month. Symbols that don’t meet these criteria won’t be shown in the scan results report.
The first column in the scan code, which is named “MChg >50%”, calculates and shows how many symbols have seen their closing prices increase by over 50% in the past month (“MARKET_COUNT(chg%(cl, cl a month ago) >= 50)”).
The second column, called “MChg <-50%”, calculates and displays the count of symbols where the closing prices have decreased by more than 50% in the past month (“MARKET_COUNT(chg%(cl, cl a month ago)<= -50)”).
You have the flexibility to modify the names of these columns to your preferences. It’s important to keep these names consistent for the scan code to work correctly.
Line 10 and 11
Add col MARKET_COUNT(chg%(cl, cl 34 bars ago) >= 13) as 34BChg >13% format 0
Add col MARKET_COUNT(chg%(cl, cl 34 bars ago)<= -13) as 34BChg <-13% format 0
Here, we’re demonstrating the use of a specific function, “chg%(cl, cl 34 bars ago)”, to determine the percentage change in the values of various symbols over the last 34 trading sessions.
We then employ two query expressions, “chg%(cl, cl 34 bars ago) >= 13” and “chg%(cl, cl 34 bars ago)<= -13”, to evaluate whether a symbol’s value has either increased by more than 13% or decreased by over 13% in the past 34 trading sessions. Symbols that do not meet these criteria will not appear in the results of the scan.
The initial column in the provided scan code, labeled “34BChg >13%”, will compute and show the number of symbols where the closing prices have risen by more than 13% (“MARKET_COUNT(chg%(cl, cl 34 bars ago) >= 13)”) over the past 34 trading sessions.
The second column, known as “34BChg <-13%”, will calculate and display the number of symbols whose closing prices have dropped by more than 13% (“MARKET_COUNT(chg%(cl, cl 34 bars ago)<= -13)”) in the past 34 trading sessions.
It’s worth noting that although you can change the names of these columns as per your preferences, it’s important to maintain consistent names for the scan to work as intended.
Line 12 and 13
Add col MARKET_COUNT(chg%(cl, cl a quarter ago) >= 25) as QChg >25% format 0
Add col MARKET_COUNT(chg%(cl, cl a quarter ago)<= -25) as QChg <-25% format 0
Here, as an example, we’re using the “chg%(cl, cl a quarter ago) ” function to calculate the percentage change in the values of symbols over the last quarter.
We then apply two query expressions, “chg%(cl, cl a quarter ago) >= 25” and “chg%(cl, cl a quarter ago)<= -25”, to determine whether a symbol’s value has either increased by more than 25% or decreased by more than 25% during the past quarter. Symbols that don’t meet these criteria won’t appear in the scan results report.
The first column, labeled “QChg >25%”, will show the number of symbols whose closing prices have increased by more than 25% during the past quarter “MARKET_COUNT(chg%(cl, cl a quarter ago) >= 25)”.
The second column, named “QChg <-25%”, will display the count of symbols whose closing prices have decreased by more than 25% during the past quarter “MARKET_COUNT(chg%(cl, cl a quarter ago)<= -25)”.
You can customize the names of these columns as per your preference, but it’s essential to use consistent names for the scan code to work correctly.
Lines 14 through 17
Add Column chg%
Add Column chg%(cl, cl a month ago) as MChg
Add Column chg%(cl, cl 34 bars ago) as 34BChg
Add Column chg%(cl, cl a quarter ago) as QChg
The “Add Column…” function is currently employed to include four additional columns in the scan results report.
The first column, which receives a default name, will show the precise percentage change in the closing price of the day.
The second column, labeled “MChg”, will display the percentage change in closing prices over the last month.
The third column, named “34BChg”, will display the percentage change in closing prices over the last 34 trading bars.
The fourth and final column, called “QChg”, will exhibit the percentage change in closing prices over the most recent quarter.
You can modify the names of all of these columns, but it’s crucial to maintain consistent names for the scan code to function accurately.
Line 18
Apply to niftymic250
The “Apply to…” function applies the scanning process to the “niftymic250” Index, that is, the scan will effectively examine all the constituent elements of NIFTYMIC250.
Line 19
Set report type to SUMMARY-DATEWISE
The “Set report type to…” function empowers users to choose how the initial scan results are presented.
When you opt for the “SUMMARY-DATEWISE” function, the scan results will appear in a concise, summarized report format. This format also permits a more detailed examination of the scan results if necessary.
In simpler terms, the “SUMMARY-DATEWISE” option arranges and displays the data in chronological order, commencing from September 1, 2023, as indicated by “from “01-Sep-2023””. This date is specified because the scan code instructs the results to be listed from this particular date, as outlined in Line 1 of the scan code above.
The Scan Report in ChartAlert
