Skip to content

Instantly share code, notes, and snippets.

@yigitcetin
Created February 8, 2022 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yigitcetin/f4f38e8f125a4c6899594d423736bf8e to your computer and use it in GitHub Desktop.
Save yigitcetin/f4f38e8f125a4c6899594d423736bf8e to your computer and use it in GitHub Desktop.
RSI Validation
# Calculate RSI
df['RSI'] = df.ta.rsi(close='Close', length=14, append=True)
# Add values to a list
stats.append(df.loc[df.shape[0] - 2, 'RSI'])
return stats, trend_dir
...
...
...
...
## <<<<<<<<<<< START LOOP HERE >>>>>>>>>>>>>>>>>
RSI = unfiltered_stats[6]
if ADX > 25 and (ADX_Slope > 0 and ((DM_plus > DM_minus and ADX > DM_minus) or (
ADX < DM_plus and ADX < DM_minus))) and DM_plus > DM_minus and RSI < 50 and trend_direction == "up":
unfiltered_stats.append("long")
unsorted_tradable_perps.append(unfiltered_stats)
elif ADX > 25 and (ADX_Slope > 0 and ((DM_plus < DM_minus and ADX > DM_plus) or (
ADX < DM_plus and ADX < DM_minus))) and DM_plus < DM_minus and RSI > 50 and trend_direction == "down":
unfiltered_stats.append("short")
unsorted_tradable_perps.append(unfiltered_stats)
@rhazeleger
Copy link

@yigitcetin Thanks, that helped me, it executes now. But indeed, without trades :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment