Using TradingView Pine Script Screener

Written by on July 15, 2025 in TradingView with 0 Comments

TradingView is a hugely popular stock charting platform. It comes bundled with hundreds of technical indicators and many are contributed by the community. I use it regularly for my stock analysis.

In addition to charting, TradingView also has a Screener that allows us to filter stocks based on our custom criteria. 

Standard Screener

Standard Screener

In the above example, we are looking for stocks whose Markert Cap is greater than equal to Rs.10 Billion, 5 year Beta is greater than 1 and Price is just above the 21-EMA.

These filtering parameters are predetermined and as long as our criteria are in this list, it will serve our purpose. No doubt this is quite useful most of the time.

Screeners such as ChartInk and Screener come with their own powerful expression languages for specifying filtering criteria. These tools give us greater control over screening stocks. Here is an example from ChartInk:

Chartink Example

Chartink Example

This looks for stocks whose last day’s Close is at least 5% more than the Open. The following stocks match that criteria.

Filtered Stocks

Filtered Stocks

It is only recently that TradingView introduced its “Pine Screener” (currently in Beta) that makes it possible to implement arbitrary filtering logic in Pine Script. To go into this mode, we have to select “Screeners > Pine” from the TradingView Products menu.

Selecting Pine Screener

Selecting Pine Screener

In order for the Pine Script to be available in the screener, we have to include the indicator in the “Favorites” list.

Here is a sample script.

Sample Script

Sample Script

This toy script contains three “plot()” functions and one “alertcondition()” function. Let us open this indicator in the Pine screener.

Opening the Script

Opening the Script in Screener

I am using my “Nifty-100” watchlist. This contains the top 100 (actually 96) companies in Nifty 100. This can be any list of yours. The “Indicator” drop down shows that I have opened my sample screener for filtering stocks from the Nifty-100 list. Notice that, by default, the three plots and the alert condition in the script are displayed. The “+” button allows us to add other plots/alerts that might be in our script (in this case there is nothing else).

Let us set our first filter condition: All stocks whose Close has just crossed above 21 EMA.

First Filter Condition

First Filter Condition

After setting this, we click “Scan”. This applies the condition on our watch list and we get 12 stocks that match.

Filtered Result

Filtered Result

Next, we add another condition: Only those stocks whose last day volume exceeds 1 million.

Result Matching Both Conditions

Stocks Matching Both Conditions

This filter reduces the number of stocks to 7.

Our final filter condition is to select those stocks whose Close >= 200 and Close <= 4000.

Third Filter Condition

Third Filter Condition

Here is the final filtered result.

Final Result

Final Result

There are only 4 stocks in this list.

Note that “alertcondition” appears with “True” option that can be enabled or reset. For “plot” elements, the actual values need to be specified.

One important point to keep in mind is that the filter conditions are “AND”ed, not “OR”ed. That is, all the conditions must be met for a stock to be in the final result. This might appear restrictive, but since we have full control over defining the conditions within Pine Script, we can implement complex logic with minimal effort.

Hope TradingView releases the final version soon, with more capabilities.

You can download the Sample code from here.

Have a nice week!

Tags: , ,

About the Author

About the Author: .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

Subscribe via RSS Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

Top