Skip to content

Commit

Permalink
v2.15 - MA Reversals improved for enhanced trend following
Browse files Browse the repository at this point in the history
  • Loading branch information
pranjal-joshi committed Nov 23, 2023
1 parent 425b1b3 commit 5d25fbb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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.14"
VERSION = "2.15"

changelog = colorText.BOLD + '[ChangeLog]\n' + colorText.END + colorText.BLUE + '''
[1.00 - Beta]
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions src/classes/Screener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 5d25fbb

Please sign in to comment.