From ebffa4275dc19940aee6aeec6763d2da2ff9e96a Mon Sep 17 00:00:00 2001 From: Pranjal-Office Date: Fri, 8 Oct 2021 16:41:06 +0530 Subject: [PATCH] v1.26 - Screen Stocks for MA Confluence --- src/classes/Changelog.py | 5 ++++- src/classes/ParallelProcessing.py | 20 ++++++++++++++------ src/classes/Screener.py | 14 ++++++++++++++ src/classes/Utility.py | 7 ++++++- src/release.md | 9 ++++----- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/classes/Changelog.py b/src/classes/Changelog.py index 662ee156..54126aa6 100644 --- a/src/classes/Changelog.py +++ b/src/classes/Changelog.py @@ -7,7 +7,7 @@ from classes.ColorText import colorText -VERSION = "1.25" +VERSION = "1.26" changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + ''' [1.00 - Beta] @@ -124,5 +124,8 @@ 2. Configuration generation on first time usage don't need restart anymore! 3. Minor bug-fixes. +[1.26] +1. New Feature: Screen for the MA Confluence pattern Option > 7 > 4. + --- END --- ''' + colorText.END diff --git a/src/classes/ParallelProcessing.py b/src/classes/ParallelProcessing.py index f7cc631b..92e5debc 100644 --- a/src/classes/ParallelProcessing.py +++ b/src/classes/ParallelProcessing.py @@ -134,13 +134,18 @@ def screenStocks(self, executeOption, reversalOption, maLength, daysForLowestVol saveDictionary['Trend'] = 'Unknown' isCandlePattern = candlePatterns.findPattern( processedData, screeningDictionary, saveDictionary) - isInsideBar = screener.validateInsideBar( - processedData, screeningDictionary, saveDictionary, chartPattern=respChartPattern, daysToLookback=insideBarToLookback) - isMomentum = screener.validateMomentum(processedData, screeningDictionary, saveDictionary) + isConfluence = False + isInsideBar = False + isIpoBase = False if respChartPattern == 3 and executeOption == 7: isIpoBase = screener.validateIpoBase(stock, fullData, screeningDictionary, saveDictionary) - + if respChartPattern == 4 and executeOption == 7: + isConfluence = screener.validateConfluence(stock, processedData, screeningDictionary, saveDictionary, percentage=insideBarToLookback) + else: + isInsideBar = screener.validateInsideBar(processedData, screeningDictionary, saveDictionary, chartPattern=respChartPattern, daysToLookback=insideBarToLookback) + + isMomentum = screener.validateMomentum(processedData, screeningDictionary, saveDictionary) if maLength is not None and executeOption == 6: isMaSupport = screener.findReversalMA(fullData, screeningDictionary, saveDictionary, maLength) @@ -176,10 +181,13 @@ def screenStocks(self, executeOption, reversalOption, maLength, daysForLowestVol self.screenResultsCounter.value += 1 return screeningDictionary, saveDictionary if executeOption == 7 and isLtpValid: - if respChartPattern != 3 and isInsideBar: + if respChartPattern < 3 and isInsideBar: + self.screenResultsCounter.value += 1 + return screeningDictionary, saveDictionary + if isConfluence: self.screenResultsCounter.value += 1 return screeningDictionary, saveDictionary - elif isIpoBase: + if isIpoBase: self.screenResultsCounter.value += 1 return screeningDictionary, saveDictionary except KeyboardInterrupt: diff --git a/src/classes/Screener.py b/src/classes/Screener.py index 79c92908..d86885b2 100644 --- a/src/classes/Screener.py +++ b/src/classes/Screener.py @@ -365,6 +365,20 @@ def validateIpoBase(self, stock, data, screenDict, saveDict, percentage=0.3): return True return False + # Find Conflucence + def validateConfluence(self, stock, data, screenDict, saveDict, percentage=0.1): + recent = data.head(1) + if(abs(recent['SMA'][0] - recent['LMA'][0]) <= (recent['SMA'][0] * percentage)): + difference = round(abs(recent['SMA'][0] - recent['LMA'][0])/recent['Close'][0] * 100,2) + if recent['SMA'][0] >= recent['LMA'][0]: + screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'Confluence ({difference}%)' + colorText.END + saveDict['MA-Signal'] = f'Confluence ({difference}%)' + else: + screenDict['MA-Signal'] = colorText.BOLD + colorText.FAIL + f'Confluence ({difference}%)' + colorText.END + saveDict['MA-Signal'] = f'Confluence ({difference}%)' + return True + return False + ''' # Find out trend for days to lookback def validateVCP(data, screenDict, saveDict, daysToLookback=ConfigManager.daysToLookback, stockName=None): diff --git a/src/classes/Utility.py b/src/classes/Utility.py index f3f97636..43b97b45 100644 --- a/src/classes/Utility.py +++ b/src/classes/Utility.py @@ -191,6 +191,7 @@ def promptChartPatterns(): 1 > Screen for Bullish Inside Bar (Flag) Pattern 2 > Screen for Bearish Inside Bar (Flag) Pattern 3 > Screen for IPO Base Breakout Pattern + 4 > Screen for the Confluence (50 & 200 MA/EMA) 0 > Cancel [+] Select option: """ + colorText.END)) if resp == 1 or resp == 2: @@ -199,7 +200,11 @@ def promptChartPatterns(): return (resp, candles) if resp == 3: return (resp, 1) - if resp >= 0 and resp <= 3: + if resp == 4: + percent = int(input(colorText.BOLD + colorText.WARN + + "\n[+] Enter Percentage within which all MA/EMAs should be (Ideal: 1-2%)? : " + colorText.END)) + return (resp, percent/100.0) + if resp >= 0 and resp <= 4: return resp raise ValueError except ValueError: diff --git a/src/release.md b/src/release.md index fbafcbe7..b7574f7f 100644 --- a/src/release.md +++ b/src/release.md @@ -1,15 +1,14 @@ ![MADE-IN-INDIA](https://img.shields.io/badge/MADE%20WITH%20%E2%9D%A4%20IN-INDIA-orange?style=for-the-badge) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/pranjal-joshi/Screeni-py?style=for-the-badge) ![GitHub all releases](https://img.shields.io/github/downloads/pranjal-joshi/Screeni-py/total?color=Green&label=Downloads&style=for-the-badge) ![MADE_WITH](https://img.shields.io/badge/BUILT%20USING-PYTHON-yellow?style=for-the-badge&logo=python&logoColor=yellow) ## What's New? +1. New **Chart Patter** Added! **MA Confluence** of 2 MA Signals for high probability trades - Try `Option > 7 > 4` :rocket: 1. New **Chart Pattern** Added! **IPO Base Breakout** - Try `Option > 7 > 3` 2. Now, Open TradingView chart directly by clicking on the stock symbol! :tada: (Windows users should download and run the Application through the **Windows Terminal** from the Microsoft Store.) -3. Screen for the Stocks in the Index that you :heart:. Index-wise Screening is here! (Thanks to [**swarpatel23**](https://github.com/swarpatel23)) 4. Now **Create Your Own Watchlist** in Excel and screen for only those stocks! Try `Option > W` :chart_with_upwards_trend: -5. Bug-fixes & Performance upgrades for MultiCore CPUs. :gear: ## Downloads -* For :desktop_computer: **Windows** users, download **[screenipy.exe](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.exe)** -* For :penguin: **Linux** users, download **[screenipy.bin](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.bin)** -* For :apple: **MacOS** users, download **[screenipy.run](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.25/screenipy.run)** ([Read Installation Guide](https://github.com/pranjal-joshi/Screeni-py/blob/main/INSTALLATION.md#for-macos)) +* For :desktop_computer: **Windows** users, download **[screenipy.exe](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.26/screenipy.exe)** +* For :penguin: **Linux** users, download **[screenipy.bin](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.26/screenipy.bin)** +* For :apple: **MacOS** users, download **[screenipy.run](https://github.com/pranjal-joshi/Screeni-py/releases/download/1.26/screenipy.run)** ([Read Installation Guide](https://github.com/pranjal-joshi/Screeni-py/blob/main/INSTALLATION.md#for-macos)) ## How to use?