Skip to content

Commit ce5852b

Browse files
v2.22 - RSI Crossing with 9 SMA of RSI
[Screenipy Test] New Features Added - Test Passed - Merge OK
2 parents 37797c4 + ced7ae8 commit ce5852b

File tree

8 files changed

+44
-12
lines changed

8 files changed

+44
-12
lines changed

.github/workflows/workflow-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
python -m pip install --upgrade pip
4141
pip install flake8 pytest pytest-mock
4242
pip install -r requirements.txt
43-
pip install --no-deps advanced-ta
43+
# pip install --no-deps advanced-ta
4444
4545
- name: Lint with flake8
4646
run: |

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ tensorflow
6868
chromadb==0.4.10
6969
mplfinance==0.12.9-beta.7
7070
num2words
71+
advanced-ta

src/classes/Changelog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from classes.ColorText import colorText
99

10-
VERSION = "2.21"
10+
VERSION = "2.22"
1111

1212
changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
1313
[1.00 - Beta]
@@ -290,4 +290,7 @@
290290
291291
[2.21]
292292
1. Dependency updated - `advanced-ta` lib for bugfixes and performance improvement in Lorentzian Classifier
293+
294+
[2.22]
295+
1. RSI and 9 SMA of RSI based reversal added - Momentum based execution strategy.
293296
''' + colorText.END

src/classes/ParallelProcessing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def run(self):
6161
sys.exit(0)
6262

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

196198
isVCP = False
197199
if respChartPattern == 4:
@@ -253,6 +255,9 @@ def screenStocks(self, tickerOption, executeOption, reversalOption, maLength, da
253255
elif reversalOption == 7 and isLorentzian:
254256
self.screenResultsCounter.value += 1
255257
return screeningDictionary, saveDictionary
258+
elif reversalOption == 8 and isRsiReversal:
259+
self.screenResultsCounter.value += 1
260+
return screeningDictionary, saveDictionary
256261
if executeOption == 7 and isLtpValid:
257262
if respChartPattern < 3 and isInsideBar:
258263
self.screenResultsCounter.value += 1

src/classes/Screener.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,23 @@ def findReversalMA(self, data, screenDict, saveDict, maLength, percentage=0.015)
421421
saveDict['MA-Signal'] = f'Reversal-{maLength}MA'
422422
return True
423423
return False
424+
425+
# Find stock showing RSI crossing with RSI 9 SMA
426+
def findRSICrossingMA(self, data, screenDict, saveDict, maLength=9):
427+
data = data[::-1]
428+
maRsi = ScreenerTA.MA(data['RSI'], timeperiod=maLength)
429+
data.insert(10,'maRsi',maRsi)
430+
data = data[::-1].head(3)
431+
if data['maRsi'].iloc[0] <= data['RSI'].iloc[0] and data['maRsi'].iloc[1] > data['RSI'].iloc[1]:
432+
screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'RSI-MA-Buy' + colorText.END
433+
saveDict['MA-Signal'] = f'RSI-MA-Buy'
434+
return True
435+
elif data['maRsi'].iloc[0] >= data['RSI'].iloc[0] and data['maRsi'].iloc[1] < data['RSI'].iloc[1]:
436+
screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'RSI-MA-Sell' + colorText.END
437+
saveDict['MA-Signal'] = f'RSI-MA-Sell'
438+
return True
439+
return False
440+
424441

425442
# Find IPO base
426443
def validateIpoBase(self, stock, data, screenDict, saveDict, percentage=0.3):

src/classes/Utility.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,10 @@ def promptReversalScreening():
236236
5 > Screen for Volume Spread Analysis (Bullish VSA Reversal)
237237
6 > Screen for Narrow Range (NRx) Reversal
238238
7 > Screen for Reversal using Lorentzian Classifier (Machine Learning based indicator)
239+
8 > Screen for Reversal using RSI MA Crossing
239240
0 > Cancel
240241
[+] Select option: """ + colorText.END))
241-
if resp >= 0 and resp <= 7:
242+
if resp >= 0 and resp <= 8:
242243
if resp == 4:
243244
try:
244245
maLength = int(input(colorText.BOLD + colorText.WARN +
@@ -262,6 +263,9 @@ def promptReversalScreening():
262263
except ValueError:
263264
print(colorText.BOLD + colorText.FAIL + '\n[!] Invalid Input! Select valid Signal Type!\n' + colorText.END)
264265
raise ValueError
266+
elif resp == 8:
267+
maLength = 9
268+
return resp, maLength
265269
return resp, None
266270
raise ValueError
267271
except ValueError:

src/release.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ Screeni-py is now on **YouTube** for additional help! - Thank You for your suppo
77

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

10-
1. **NSE Indices** added to find Sectoral opportunities - Try Index `16 > Sectoral Indices`
11-
2. **Backtesting Reports** Added for Screening Patterns to Develope and Test Strategies!
12-
3. **Position Size Calculator** tab added for Better and Quick Risk Management!
13-
4. **Lorentzian Classification** (invented by Justin Dehorty) added for enhanced accuracy for your trades - - Try `Option > 6 > 7` 🤯
14-
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`
15-
6. **Search Similar Stocks** Added using Vector Similarity search - Try `Search Similar Stocks`.
16-
7. New Screener **Buy at Trendline** added for Swing/Mid/Long term traders - Try `Option > 7 > 5`.
10+
1. **RSI** based **Reversal** using *9 SMA* of RSI - Try `Option > 6 > 8`
11+
2. **NSE Indices** added to find Sectoral opportunities - Try Index `16 > Sectoral Indices`
12+
3. **Backtesting Reports** Added for Screening Patterns to Develope and Test Strategies!
13+
4. **Position Size Calculator** tab added for Better and Quick Risk Management!
14+
5. **Lorentzian Classification** (invented by Justin Dehorty) added for enhanced accuracy for your trades - - Try `Option > 6 > 7` 🤯
15+
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`
16+
7. **Search Similar Stocks** Added using Vector Similarity search - Try `Search Similar Stocks`.
17+
8. New Screener **Buy at Trendline** added for Swing/Mid/Long term traders - Try `Option > 7 > 5`.
1718

1819
## Installation Guide
1920

src/streamlit_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None,
225225
'4 > Reversal at Moving Average (Bullish Reversal)',
226226
'5 > Volume Spread Analysis (Bullish VSA Reversal)',
227227
'6 > Narrow Range (NRx) Reversal',
228-
'7 > Lorentzian Classifier (Machine Learning based indicator)'
228+
'7 > Lorentzian Classifier (Machine Learning based indicator)',
229+
'8 > RSI Crossing with 9 SMA of RSI itself'
229230
]
230231
).split(' ')[0])
231232
if select_reversal == 4:

0 commit comments

Comments
 (0)