This functionality was introduced in October 2023 (Version 23.10.1)
List symbols Add Column Close Add Column Volume format 0,000 Add Column IIF(cl > ema(50),1,0) as IsAbvEMA Group rows by IsAbvEMA Add Column CHG%(cl,ema(50)) as Diff% Sort on Column Diff% desc Add Column MARKET_COUNT(cl > ema(50)) as AbvEMA Add Column MARKET_COUNT (cl < ema(50)) as BlwEMA Add col MARKET_PERCENT(cl > ema(50)) as AbvEMA% Add col MARKET_PERCENT(cl < ema(50)) as BlwEMA% Apply to NIFTY500 plot ema(50)
Below is a breakdown of the scan presented in a step-by-step manner.
Purpose of the Scan
- The objective is to perform a scan on a list of symbols to identify whether the most recent closing price of these symbols is either higher or lower than their respective 50-bar Exponential Moving Average (EMA).
- Then, the symbols will be categorized into two groups: those above the 50-bar EMA and those below it. This categorization will be done using an IF/THEN expression.
- The next step is to determine the count of symbols in each group. This count will be presented both as a raw number and as a percentage of the total number of symbols.
- Conversely, we will also calculate and display the count and percentage of symbols that are below the 50-bar EMA.
- Additionally, we will calculate the difference between the latest closing price of these symbols and their 50-bar EMA. This data will be arranged in descending order.
- Finally, we will present the latest closing prices and the trading volume for all of these symbols. This entire process will be applied to the components of the NIFTY500 index.
The “List symbols” function holds significance in the process of creating a list of symbols. In the present context, it will perform this task without imposing any specific conditions or filters.
Lines 2 and 3
Add Column Close Add Column Volume format 0,000
The “Add Column…” function is used to show more information in a scan report.
In this case, it will display two columns: one for the most recent closing price (“Close ”) and another for the most recent trading volume (“Volume”). The numbers in the “Volume” column will be shown in millions (“format 0,000”).
To keep things uncomplicated, these columns will be given default names, which are “Close” and “Volume” respectively.
Lines 4 and 5
Add Column IIF(cl > ema(50),1,0) as IsAbvEMA Group rows by IsAbvEMA
Line 4 in this scan code will add another column to the display, and this new column will show the result of an IF/THEN expression.
In our current situation, the expression (“IIF(cl > ema(50),1,0)”) we’re looking at is “Is the most recent closing price greater than its 50-bar Exponential Moving Average (EMA)?”
If a stock is trading above its EMA(50), the “IIF” expression will give a value of “1” for True, but if a stock is trading below its “ema(50)”, the “IIF” expression will give a value of “0” for False.
This new column will be called “IsAbvEMA” (you can change this name to whatever you like).
Line 5 uses the “Group rows by…” function, and it helps organize the scan results report, which consists of rows and columns, by the title of the column, in this case, “IsAbvEMA”.
Lines 6 and 7
Add Column CHG%(cl,ema(50)) as Diff% Sort on Column Diff% desc
The scan code, when executed, will introduce a new column with the label “Diff%”. This label can be customized to your preference.
Within this column, you will find information about the percentage change (“CHG%()”) of a symbol’s closing price (“cl”) in relation to its 50-period Exponential Moving Average (“ema(50)”).
The “Sort on Column…” function will enable you to arrange this new column in either an ascending or descending order. In this particular situation, the “Diff%” column will be organized in a descending order (“desc“), meaning the highest values will be at the top.
Lines 8 through 11
Add Column MARKET_COUNT(cl > ema(50)) as AbvEMA Add Column MARKET_COUNT (cl < ema(50)) as BlwEMA Add col MARKET_PERCENT(cl > ema(50)) as AbvEMA% Add col MARKET_PERCENT(cl < ema(50)) as BlwEMA%
The “MARKET_COUNT()” function, newly introduced in the Advanced Scanner, serves as a tool for counting market-wide variables or parameters. In simpler terms, it allows you to scan and tally various factors across an entire market.
Similarly, the “MARKET_PERCENT()” function, also a newcomer in this context, acts as a market aggregate tool. It differs from “MARKET_COUNT()” by presenting market-wide variables as percentages, making it easier to understand how these variables relate to the whole market.
The “Add Column…” function, once again, allows you to enhance the scan results report by adding four additional columns. Here’s what each of these columns will contain:
- The first column, titled “AbvEMA” (you can rename it as needed), will count and display the number of symbols where the latest closing price is higher than its 50-bar EMA (“MARKET_COUNT(cl > ema(50))”). This information helps you identify symbols performing above this EMA threshold.
- The third column, named “AbvEMA%” (modifiable according to your preference), will display the result from the first column in percentage terms “MARKET_PERCENT(cl > ema(50))”. It quantifies the percentage of symbols exceeding the 50-bar EMA, providing a clearer picture of their performance.
- The second column, titled “BlwEMA” (also customizable to your liking), will count and display the number of symbols where the latest closing price is below the 50-bar EMA (“MARKET_COUNT (cl < ema(50))”). This column is valuable for identifying symbols that are underperforming relative to this EMA.
- The fourth column, labeled “BlwEMA%” (adjustable to your preference), will show the output of the second column in percentage terms (“MARKET_PERCENT(cl < ema(50))”). It quantifies the percentage of symbols trading below the 50-bar EMA, offering a percentage-based insight into their performance.
Apply to NIFTY500
The “Apply to…” function applies the scanning process to the “NIFTY500” Index, that is, the scan will effectively examine all the constituent elements of NIFTY500.
The “plot ” function will simply plot the 50-period EMA (“ema(50)”) when a qualifying symbol is opened from within the scan results report in ChartAlert.