Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
bollinger_rsi
Browse files Browse the repository at this point in the history
  • Loading branch information
fox committed Nov 16, 2023
1 parent 583ba3c commit e7553f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions algorithms/custom_bollinger_rsi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from bollinger_bands import algorithm as bollinger_bands
from rsi import algorithm as rsi

def algorithm(prices, rsi_window=13, bollinger_window=30):
upper_band, lower_band, middle_band = bollinger_bands(prices, window_size=bollinger_window)
rsi_line = rsi(prices, window_size=rsi_window)

return upper_band, lower_band, middle_band, rsi_line

def signal(prices, data):
price = prices[-1]
upper_band, lower_band, middle_band , rsi_line = data

if price >= lower_band[-1] and 30 >= rsi_line[-1]:
return 'buy', 0.5

if price >= upper_band[-1] and rsi_line[-1] >= 70:
return 'sell', 1


0 comments on commit e7553f0

Please sign in to comment.