Package: pkscreener
PKScreenerWhat is PKScreener?Telegram AlertsNifty AI PredictionScheduling Cron JobsOn-Demand Telegram BotBacktesting / Growth of 10kNifty screeningVolume scannersBreakout detectionConsolidating stocksReversal SignalsChart PatternsCCI scanners2% scannersShort-term bullsNR4 / NR7Weekly ReleasesFair ValueMutual funds, FII dataTTM SqueezeGolden CrossoverDeath CrossoverRSI screeningMACD scannersIPO StocksMomentum GainersWatchlist screeningStock Performance52Wk H/L Breakouts10 days low breakoutsAroon CrossoverNext Day Bullish StocksToday's BreakoutsBreaking out nowPopular stocks by Mutual Funds / FIIsHigher HighsLower LowsF&O Stocks screeningLive 5-EMA Index ScanLoggingTelegram ChannelEarly BreakoutsA Python-based stock screener for NSE, India.pkscreeneris an advanced stock screener to find potential breakout stocks from NSE and tell it's possible breakout values. It also helps to find the stocks which are consolidating and may breakout, or the particular chart patterns that you're looking specifically to make your decisions.
pkscreener is totally customizable and it can screen stocks with the settings that you have provided.You can get daily scan results/alerts at scheduled times by subscribing to the following Telegram channel:PurposeDescription/linkQR CodeAlerts Channelhttps://t.me/PKScreener> You wil receive all the major alerts on this telegram channel. These alerts are sent for all major strategy scans daily around 9:30am-10:15am and then around 4pm. You will also receive the next day's market predictions.Receiving Scheduled Scan resultsIf you would like to receive the scan results, please join the telegram channel and group above.
You may receive the following scan results:by 4pm IST, Monday - FridayFor all Nifty stocks at/by 9:45-10:15am and by 4pm IST, Monday - FridayCertain selected but configurable alerts for specific scan typesReceiving On-Demand Scan resultsYou can now run thepkscreenerboton your local machine or if it's running on the GitHub server under a GitHub Actions workflow, you can use thepkscreener Bot(@nse_pkscreener_bot on Telegram) to get on-demand scan results.ScannersScreening options to choose from:Artificial Intelligence v2 for Nifty 50 PredictionLive Index Scan : 5 EMA for IntradayScreen stocks by the stock names (NSE Stock Code)Nifty 50Nifty Next 50Nifty 100Nifty 200Nifty 500Nifty Smallcap 50Nifty Smallcap 100Nifty Smallcap 250Nifty Midcap 50Nifty Midcap 100Nifty Midcap 150Nifty (All Stocks)Newly Listed (IPOs in last 2 Year)F&O Stocks OnlyFollowin scanners are already implemented. Others areIn Progress0 > Full Screening (Shows Technical Parameters without any criterion)
     1 > Probable Breakouts              	2 > Today's Breakouts
     3 > Consolidating stocks            	4 > Lowest Volume in last 'N'-days (Early Breakout Detection)
     5 > RSI screening                   	6 > Reversal Signals
     7 > Stocks making Chart Patterns    	8 > CCI outside of the given range
     9 > Volume gainers                  	10 > Closing at least 2% up since last 3 days
    11 > Short term bullish stocks(Intraday)	12 > 15 Minute Price & Volume breakout(Intraday)
    13 > Bullish RSI & MACD(Intraday)       	14 > NR4 Daily Today
    15 > 52 week low breakout(today/1 wk)	16 > 10 days low breakout
    17 > 52 week high breakout(today/1 wk)	18 > Bullish Aroon(14) Crossover
    19 > MACD Histogram x below 0       	20 > Bullish for next day
    21 > Most Popular Stocks            	22 > View Stock Performance         
    23 > Breaking out now               	24 > Higher Highs,Lows & Close      
    25 > Lower Highs,Lows (Watch for Reversal)How to use on your own local Windows/Linux/Macbook laptop?Using docker, running within docker containerDownload and install docker desktop:https://docs.docker.com/get-docker/After installation, launch/run docker desktop and if it asks, login using your docker credentials.Launch any command line (for example, cmd on windows or terminal on Mac) and typedocker pull pkjmesra/pkscreener:latest. Then typedocker run -it pkjmesra/pkscreener:latest.The option-iwill open thepkscreenerin interactive mode within docker.-twill allocate a pseudo terminal for you so you can begin to usepkscreenerInstalling the latest version from PyPi.Go ahead and install usingpip install pkscreenerThis should install all of the major dependencies, except maybe, TA-Lib.This app can still run without TA-Lib, but if you need to install TA-Lib for technical indicators (which otherwise is used frompandas_tain the absence of TA-Lib), you can do this: Head to.github/dependencies/under this repo. Download the respective TA-Lib file/whl file and install either from the .whl file or from source. Check out any of the workflow files for steps to install TA-Lib.For example:ForWindows: Seehttps://github.com/pkjmesra/PKScreener/blob/c1e94ba3137915cb781161fa2d5fb69129940fd3/.github/workflows/w1-workflow-build-matrix.yml#L91-L101ForMac: Runbrew install ta-libassuming you have homebrew installed.ForUbuntu/Linux: Seehttps://github.com/pkjmesra/PKScreener/blob/main/.github/workflows/w1-workflow-build-matrix.yml#L121-L132Now launch your favorite command line CLI and issuepkscreener. This will launch the pkscreener executable.Building from source repoInstall python 3.9 for your OS/CPU. Download the installer fromhttps://www.python.org/downloads/release/python-3913/#FilesJust clone the repo withgit clone https://github.com/pkjmesra/PKScreener.gitcd PKScreenerpip install -r requirements.txt.(Optional) If you would like to have technical indicators evaluated using TA-Lib, go ahead and install TA-Lib as well.pip3 install ta-lib. Please review additional steps to buil TA-Lib in the workflow files meant for your OS under .github > workflows and follow the line numbers from the previous section.cd pkscreenerFinally, from within thepkscreenerdirectory, runpython pkscreenercli.py. Or just type/runpkscreener. You are all set.Running the executablesDownload the suitable file according to your OS.Linux & Mac users should make sure that thepkscreenercli.bin or pkscreenercli.runis havingexecutepermission. (chmod +x pkscreenercli.run)Runthe file. Following window will appear.Configurethe parameters as per your requirement usingOption > E.Scanner Menusthe scanner menus for each level/sub-levelFollowing are the screenshots of screening and output results.Results :It also shows you how the chosen scan option has fared in the past. 1-Pd, 2-Pd means 1 day, 2 days from the date of scan in the past when those stocks came into the results of the chosen scan option.Once done, you can also save the results in an excel file.Growth of 10kYou can see the performance of your stocks and/or at portfolio level using "Growth of 10k".It also summarises the Growth of 10k at portfolio level for the last quarter so that you know which filters worked best in the past:BacktestsYou can now use theBacktestsmenu to backtest any of the selected strategies. Seehttps://pkjmesra.github.io/PKScreener/BacktestReports.htmlOnce done, you can also view the output html file saved at the same location from where you launched the app.Scanning as a scheduled job once or at regular intervalsRunning it once with pre-defined inputs
You can also run it as a one time job in any scheduler with pre-defined options. For example./pkscreenercli.py -a Y -o X:12:10 -e(orpkscreenercli.exe -a Y -o X:12:10 -eif you're executing with the exe) will run the scanner for all Nifty stocks and find all stocks matching CCI filter, save the results in xlsx file and exit../pkscreenercli.py -a Y -o X:12:9:2.5 -ewill run the scanner (menu optionX) for all Nifty stocks (menu option12) to find volume gainers (menu option9) with at least the volume multiplier of 2.5 (input variable2.5), save the results in xlsx file and exit (menu option-e). Passing in the-poption for examplepkscreenercli.py -a Y -p -o X:12:6:1 -ewill also silence all command line prints/outputs and just run silently for the given options, save results and exit. Try and see all options with./pkscreenercli.py -h.Running it at regular intervals
If you want to runn it at regular intervals, you can just pass the interval in-ccommand line option. For example,./pkscreenercli.py -a Y -o X:12:6:1 -c 180will run it every180seconds with console outputs also being printed. If you'd just like it to run as a cron job without console outputs, you may also pass the-pparameter. For example,./pkscreenercli.py -a Y -p -o X:12:6:1 -c 180Understanding the Result Table:The Result table contains a lot of different parameters which can be pretty overwhelming to the new users, so here's the description and significance of each parameter.SrParameterDescriptionExample1StockThis is a NSE scrip symbol. If your OS/Terminal supports unicode, You can directly openTradingViewcharts by pressingCtrl+Clickon the stock name.TATAMOTORS2ConsolidatingIt gives the price range in which stock is trading since lastNdays.Nis configurable and can be modified by executingEdit User Configurationoption.If stock is trading between price 100-120 in last 30 days, Output will beRange:20.0 %3Breakout (N Days)This is pure magic! TheBOis Breakout level in last N days whileRis the next resistance level if available. Investor should consider both BO & R level to decide entry/exits in their trades.B:302, R:313(Breakout level is 100 & Next resistance is 102)4LTPLTP is the Last Traded Price of an asset traded on NSE.298.7(Stock is trading at this price)5VolumeVolume shows the relative volume of the recent candle with respect to 20 period MA of Volume. It could beUnknownfor newly listed stocks.if 20MA(Volume) is 1M and todays Volume is 2.8M, thenVolume = 2.8x6MA-SignalIt describes the price trend of an asset by analysing various 50-200 MA/EMA crossover strategies.200MA-Support,BullCross-50MAetc7RSIFor the momentum traders, it describes 14-period RSI for quick decision making about their trading plans0 to 1008TrendBy using advance algorithms, the average trendlines are computed forNdays and their strenght is displayed depending on steepness of trendlines. (This does NOT show any trendline on chart, it is calculated internally)Strong Up,Weak Downetc.9PatternIf the chart or the candle itself forming any important pattern in the recent timeframe or as per the selected screening option, various important patterns will be indicated here.Momentum Gainer,Inside Bar (N),Bullish Engulfingetc.Hack it your way:Feel free to Edit the parameters in thepkscreener.inifile which will be generated by the application.[config]
period = 450d
daystolookback = 22
duration = 1d
minprice = 20.0
maxprice = 50000.0
volumeratio = 2.5
consolidationpercentage = 10.0
shuffle = y
cachestockdata = y
onlystagetwostocks = y
useema = n
showunknowntrends = y
logsenabled = n
generaltimeout = 2.0
longtimeout = 4.0
maxnetworkretrycount = 10
backtestperiod = 60
minimumvolume = 10000Try to tweak this parameters as per your trading styles. For example, If you're comfortable with weekly charts, makeduration=5dand so on. For intraday, you can setperiod=1d and duration=5mif you would like to calculate with 5minute candles. Set the duration to15mor whatever value you desire, but keep the period to1d. This tool, however, works best for short/mid term instead of intraday, but some scans like momentum/volume/NR4 etc can be used for screening stocks for intraday as well. You can use the toggle menu optionTto toggle between long term and intraday config before you begin the scanners.Creating your own Telegram channel to receive your own alerts:You can create your own telegram channel to receive alerts wherenevr you run it locally on your laptop either from a command line interface console or run it as a scheduler. Simply, go ahead andCreate a bot for yourself, then a channel and get their IDs. Follow the steps inhttps://medium.com/codex/using-python-to-send-telegram-messages-in-3-simple-steps-419a8b5e5e2andhttps://www.siteguarding.com/en/how-to-get-telegram-bot-api-tokenAfter you have created the bot usingbotFatherand have received/verified your bot id/token and channel ID usingget id bot, simply go topkscreenerfolder in the source code directory and create a.env.devfile with the following (If you are instead using the .exe or .bin or .run file from release, just create this file in the same folder where the executable (.exe or .bin or .run) is placed.)CHAT_ID=Your_Channel_Id_Here_Without_A_Hyphen_or_Minus_Sign
TOKEN=Your_Bot_Token_Here
chat_idADMIN=Your_Own_ID_HereFrom now on, you will begin to receive your own alerts on your telegram channel.Troubleshooting and Logs:If you are having issues running the program, you can just launch a command line interface (On windows> Start > Run > cmd) and then launch PKScreener with a command line option of-l. For example,python pkscreenercli.py -l. This will show you the path where the program will save all the log outputs from this run. Copy that path and go ahead and run the application. Altenatively, you can just go ahead and modify thelogsEnabledvalue toy, save & close it and then runpython pkscreenercli.py.After you have finished the run, go to that copied path, zip the contents of the filepkscreener-logs.txtand create an issue athttps://github.com/pkjmesra/PKScreener/issues. Please do not forget to attach the log files in the issue.Contributing:Please feel free to Suggest improvements bugs by creating an issue.Please follow theGuidelines for Contributingwhile making a Pull Request.Disclaimer:DO NOT use the results provided by the software 'solely' to make your trading decisions.Always backtest and analyze the stocks manually before you trade.The Author(s), the software and any related/unrelated entity will not be held liable for your own investing decisions or losses. The authors or this softfware does not make any claim about the correctness of the results.This screener began as aforkbut has since added a lot of additional scanners, backtesting, Telegram bots, Alerts and a number of modifications and improvements.