Skip to content

Commit

Permalink
v2.22 - RSI Crossing with 9 SMA of RSI
Browse files Browse the repository at this point in the history
[Screenipy Test] New Features Added - Test Passed - Merge OK
  • Loading branch information
pranjal-joshi committed Mar 27, 2024
2 parents 37797c4 + ced7ae8 commit ce5852b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest pytest-mock
pip install -r requirements.txt
pip install --no-deps advanced-ta
# pip install --no-deps advanced-ta
- name: Lint with flake8
run: |
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ tensorflow
chromadb==0.4.10
mplfinance==0.12.9-beta.7
num2words
advanced-ta
5 changes: 4 additions & 1 deletion src/classes/Changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from classes.ColorText import colorText

VERSION = "2.21"
VERSION = "2.22"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -290,4 +290,7 @@
[2.21]
1. Dependency updated - `advanced-ta` lib for bugfixes and performance improvement in Lorentzian Classifier
[2.22]
1. RSI and 9 SMA of RSI based reversal added - Momentum based execution strategy.
''' + colorText.END
7 changes: 6 additions & 1 deletion src/classes/ParallelProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run(self):
sys.exit(0)

def screenStocks(self, tickerOption, executeOption, reversalOption, maLength, daysForLowestVolume, minRSI, maxRSI, respChartPattern, insideBarToLookback, totalSymbols,
configManager, fetcher, screener, candlePatterns, stock, newlyListedOnly, downloadOnly, vectorSearch, isDevVersion, backtestDate, printCounter=False):
configManager, fetcher, screener:Screener.tools, candlePatterns, stock, newlyListedOnly, downloadOnly, vectorSearch, isDevVersion, backtestDate, printCounter=False):
screenResults = pd.DataFrame(columns=[
'Stock', 'Consolidating', 'Breaking-Out', 'MA-Signal', 'Volume', 'LTP', 'RSI', 'Trend', 'Pattern'])
screeningDictionary = {'Stock': "", 'Consolidating': "", 'Breaking-Out': "",
Expand Down Expand Up @@ -192,6 +192,8 @@ def screenStocks(self, tickerOption, executeOption, reversalOption, maLength, da
isVSA = screener.validateVolumeSpreadAnalysis(processedData, screeningDictionary, saveDictionary)
if maLength is not None and executeOption == 6 and reversalOption == 4:
isMaSupport = screener.findReversalMA(fullData, screeningDictionary, saveDictionary, maLength)
if executeOption == 6 and reversalOption == 8:
isRsiReversal = screener.findRSICrossingMA(fullData, screeningDictionary, saveDictionary)

isVCP = False
if respChartPattern == 4:
Expand Down Expand Up @@ -253,6 +255,9 @@ def screenStocks(self, tickerOption, executeOption, reversalOption, maLength, da
elif reversalOption == 7 and isLorentzian:
self.screenResultsCounter.value += 1
return screeningDictionary, saveDictionary
elif reversalOption == 8 and isRsiReversal:
self.screenResultsCounter.value += 1
return screeningDictionary, saveDictionary
if executeOption == 7 and isLtpValid:
if respChartPattern < 3 and isInsideBar:
self.screenResultsCounter.value += 1
Expand Down
17 changes: 17 additions & 0 deletions src/classes/Screener.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,23 @@ def findReversalMA(self, data, screenDict, saveDict, maLength, percentage=0.015)
saveDict['MA-Signal'] = f'Reversal-{maLength}MA'
return True
return False

# Find stock showing RSI crossing with RSI 9 SMA
def findRSICrossingMA(self, data, screenDict, saveDict, maLength=9):
data = data[::-1]
maRsi = ScreenerTA.MA(data['RSI'], timeperiod=maLength)
data.insert(10,'maRsi',maRsi)
data = data[::-1].head(3)
if data['maRsi'].iloc[0] <= data['RSI'].iloc[0] and data['maRsi'].iloc[1] > data['RSI'].iloc[1]:
screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'RSI-MA-Buy' + colorText.END
saveDict['MA-Signal'] = f'RSI-MA-Buy'
return True
elif data['maRsi'].iloc[0] >= data['RSI'].iloc[0] and data['maRsi'].iloc[1] < data['RSI'].iloc[1]:
screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'RSI-MA-Sell' + colorText.END
saveDict['MA-Signal'] = f'RSI-MA-Sell'
return True
return False


# Find IPO base
def validateIpoBase(self, stock, data, screenDict, saveDict, percentage=0.3):
Expand Down
6 changes: 5 additions & 1 deletion src/classes/Utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ def promptReversalScreening():
5 > Screen for Volume Spread Analysis (Bullish VSA Reversal)
6 > Screen for Narrow Range (NRx) Reversal
7 > Screen for Reversal using Lorentzian Classifier (Machine Learning based indicator)
8 > Screen for Reversal using RSI MA Crossing
0 > Cancel
[+] Select option: """ + colorText.END))
if resp >= 0 and resp <= 7:
if resp >= 0 and resp <= 8:
if resp == 4:
try:
maLength = int(input(colorText.BOLD + colorText.WARN +
Expand All @@ -262,6 +263,9 @@ def promptReversalScreening():
except ValueError:
print(colorText.BOLD + colorText.FAIL + '\n[!] Invalid Input! Select valid Signal Type!\n' + colorText.END)
raise ValueError
elif resp == 8:
maLength = 9
return resp, maLength
return resp, None
raise ValueError
except ValueError:
Expand Down
15 changes: 8 additions & 7 deletions src/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Screeni-py is now on **YouTube** for additional help! - Thank You for your suppo

⚠️ **Executable files (.exe, .bin and .run) are now DEPRECATED! Please Switch to Docker**

1. **NSE Indices** added to find Sectoral opportunities - Try Index `16 > Sectoral Indices`
2. **Backtesting Reports** Added for Screening Patterns to Develope and Test Strategies!
3. **Position Size Calculator** tab added for Better and Quick Risk Management!
4. **Lorentzian Classification** (invented by Justin Dehorty) added for enhanced accuracy for your trades - - Try `Option > 6 > 7` 🤯
5. **Artificial Intelligence v3 for Nifty 50 Prediction** - Predict Next day Gap-up/down using Nifty, Gold and Crude prices! - Try `Select Index for Screening > N`
6. **Search Similar Stocks** Added using Vector Similarity search - Try `Search Similar Stocks`.
7. New Screener **Buy at Trendline** added for Swing/Mid/Long term traders - Try `Option > 7 > 5`.
1. **RSI** based **Reversal** using *9 SMA* of RSI - Try `Option > 6 > 8`
2. **NSE Indices** added to find Sectoral opportunities - Try Index `16 > Sectoral Indices`
3. **Backtesting Reports** Added for Screening Patterns to Develope and Test Strategies!
4. **Position Size Calculator** tab added for Better and Quick Risk Management!
5. **Lorentzian Classification** (invented by Justin Dehorty) added for enhanced accuracy for your trades - - Try `Option > 6 > 7` 🤯
6. **Artificial Intelligence v3 for Nifty 50 Prediction** - Predict Next day Gap-up/down using Nifty, Gold and Crude prices! - Try `Select Index for Screening > N`
7. **Search Similar Stocks** Added using Vector Similarity search - Try `Search Similar Stocks`.
8. New Screener **Buy at Trendline** added for Swing/Mid/Long term traders - Try `Option > 7 > 5`.

## Installation Guide

Expand Down
3 changes: 2 additions & 1 deletion src/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None,
'4 > Reversal at Moving Average (Bullish Reversal)',
'5 > Volume Spread Analysis (Bullish VSA Reversal)',
'6 > Narrow Range (NRx) Reversal',
'7 > Lorentzian Classifier (Machine Learning based indicator)'
'7 > Lorentzian Classifier (Machine Learning based indicator)',
'8 > RSI Crossing with 9 SMA of RSI itself'
]
).split(' ')[0])
if select_reversal == 4:
Expand Down

0 comments on commit ce5852b

Please sign in to comment.