# Stock Screener – Example 17: One Parameter Multiple Values (Noiseless Charts) (“Set chart type to…”)

This is an example of an optimized scan that demonstrates the enhanced (“Set chart type to…”) function; it can replace the need for writing several scans (as was required in the older versions of ChartAlert)

5 minutes

This functionality was 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 parameter can now accept multiple values/ inputs for scanning, now replaces the need for writing atleast four separate scans as was required in the previous versions of ChartAlert.

``````[BEGIN P&F Double Top Buy PercentValue%]
Set OptVar PercentValue = 0.5, 1, 1.5, 2
List symbols where pattern is PF Double Top Buy
Set chart type to PF(PERCENTAGETYPE,PercentValue)
Apply to NIFTYTOTAL
Plot
[END]

[BEGIN P&F Double Bottom Sell PercentValue%]
Set OptVar PercentValue = 0.5, 1, 1.5, 2
List symbols where pattern is PF Double Bottom Sell
Set chart type to PF(PERCENTAGETYPE,PercentValue)
Apply to NIFTYTOTAL
Plot
[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 a P&F Double Top Buy pattern, and a P&F Double Bottom Sell pattern, have been triggered on 4 different percentage-based Point & Figure charts. The percentages used for computing the P&F chart type are 0.5%, 1%, 1.5% and 2%. The P&F Double Top Buy pattern is a bullish signal and the P&F Double Bottom Sell pattern is a bearish signal.
2. To display the values of the top of the current P&F column of Xs in the case of a bullish signal, and the bottom of the current P&F column of Os in the case of a bearish signal.
3. To scan the components of the following index: NIFTYTOTAL
4. To plot the P&F chart type and the P&F pattern on the chart if a symbol is opened from inside the scan results report.

Let’s go!

#### Line 1

``[BEGIN P&F Double Top Buy PercentValue%] ``

The first section or block of the optimized scan procedure starts with a “BEGIN” command.

The text “P&F Double Top Buy PercentValue%” that comes after the “BEGIN” command serves as the designated heading for the scan results that will be showcased in the scan report.

#### Line 2

``Set OptVar PercentValue = 0.5, 1, 1.5, 2``

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

The optimized variable “PercentValue” will function as a placeholder within the scan heading and will be substituted with 4 input values “0.5,” “1,” “1.5,” “2.”

You can customize the term “PercentValue” with anything of your choosing . . . Just remember to globally replace them for the scan to work.

#### Line 3

``List symbols where pattern is PF Double Top Buy``

This scan will generate a list of symbols where the condition “pattern is PF Double Top Buy” is met.

Here, “PF” refers to a Point & Figure chart, and “Double Top Buy” refers to a Point & Figure pattern.

#### Line 4 and 5

``````Add Column PFTOP

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 top of the current P&F column (“PFTOP”), and the latest close (“CandleClose”).

Since these columns have not been given an explicit name, they will be named (in the scan results) after their function names, namely, “PFTOP” and “CandleClose,” respectively.

#### Line 6

``Set chart type to PF(PERCENTAGETYPE,PercentValue)``

The “Set chart type to…” function provides you with the flexibility to convert your data stream into your preferred chart type before initiating the scanning process.

For instance, in ChartAlert, you can seamlessly transform the OHLC data stream into various chart types such as Point & Figure, Renko, Kagi, Three Line Break, or Line charts, among others, prior to commencing the scanning operation. Please note that the default chart type for scanning is Candlestick.

In the current context, the data stream will be converted into a percentage-based Point & Figure chart type (“PF(PERCENTAGETYPE,PercentValue)”) just before executing the scan, and the “PercentValue” variable will be replaced in an iteration with four percentage values: 0.5%, 1%, 1.5% and 2%.

#### Line 7

``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 8

``Plot``

The “Plot” function will simply plot the Point & Figure chart along with the relevant P&F pattern (“PF Double Top Buy”) when a qualifying symbol is opened from within a scan results report in ChartAlert.

#### Line 9

``[END]``

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

#### Lines 10 through 18

``````[BEGIN P&F Double Bottom Sell PercentValue%]
Set OptVar PercentValue = 0.5, 1, 1.5, 2
List symbols where pattern is PF Double Bottom Sell