diff --git a/src/classes/Changelog.py b/src/classes/Changelog.py index e2a92b6d..4cbec067 100644 --- a/src/classes/Changelog.py +++ b/src/classes/Changelog.py @@ -7,7 +7,7 @@ from classes.ColorText import colorText -VERSION = "2.14" +VERSION = "2.15" changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + ''' [1.00 - Beta] @@ -268,4 +268,7 @@ [2.14] 1. Dropdowns added for duration and period in configration tab +[2.15] +1. MA Reversal improved for trend following (Inspired from Siddhart Bhanushali's 44 SMA) + ''' + colorText.END diff --git a/src/classes/Screener.py b/src/classes/Screener.py index 43b09e47..55f735d1 100644 --- a/src/classes/Screener.py +++ b/src/classes/Screener.py @@ -414,6 +414,9 @@ def findReversalMA(self, data, screenDict, saveDict, maLength, percentage=0.015) data.insert(10,'maRev',maRev) data = data[::-1].head(3) if data.equals(data[(data.Close >= (data.maRev - (data.maRev*percentage))) & (data.Close <= (data.maRev + (data.maRev*percentage)))]) and data.head(1)['Close'].iloc[0] >= data.head(1)['maRev'].iloc[0]: + if self.configManager.stageTwo: + if data.head(1)['maRev'].iloc[0] < data.head(2)['maRev'].iloc[1] or data.head(2)['maRev'].iloc[1] < data.head(3)['maRev'].iloc[2] or data.head(1)['SMA'].iloc[0] < data.head(1)['LMA'].iloc[0]: + return False screenDict['MA-Signal'] = colorText.BOLD + colorText.GREEN + f'Reversal-{maLength}MA' + colorText.END saveDict['MA-Signal'] = f'Reversal-{maLength}MA' return True diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 864c668a..2e124984 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -210,7 +210,7 @@ def get_extra_inputs(tickerOption, executeOption, c_index=None, c_criteria=None, ] ).split(' ')[0]) if select_reversal == 4: - ma_length = c2.number_input('MA Length', value=50, step=1, format="%d") + ma_length = c2.number_input('MA Length', value=44, step=1, format="%d") execute_inputs = [tickerOption, executeOption, select_reversal, ma_length, 'N'] elif select_reversal == 6: range = c2.number_input('NR(x)',min_value=1, max_value=14, value=4, step=1, format="%d")