diff --git a/strategies/internal_bar_strength.py b/strategies/internal_bar_strength.py new file mode 100644 index 0000000..4cfa0c9 --- /dev/null +++ b/strategies/internal_bar_strength.py @@ -0,0 +1,9 @@ +from pandas import DataFrame, Series + +def signals(data: DataFrame) -> Series: + """ + Calculate the Internal Bar Strength (IBS) signal. + Returns a Series with 'L' for long signals and 'N' otherwise. + """ + ibs_series = (data['Close'] - data['Low']) / (data['High'] - data['Low']) + return ibs_series.apply(lambda ibs: 'L' if ibs < 0.2 else 'N')