diff --git a/strategies/five_period_rsi.py b/strategies/five_period_rsi.py new file mode 100644 index 0000000..cd44776 --- /dev/null +++ b/strategies/five_period_rsi.py @@ -0,0 +1,15 @@ +import numpy as np +from pandas import DataFrame, Series +from indicators import rsi + +def five_period_rsi(data: DataFrame) -> Series: + """ + Generate signals based on the 5-period RSI strategy. + + Returns a Series with 'L' for long signals and 'N' otherwise. + """ + rsi_5 = rsi(data, period = 5) + rsi_below_35 = rsi_5 < 35 + + signals = np.where(rsi_below_35, 'L', 'N') + return Series(signals, index = data.index) \ No newline at end of file