From 26dd0129f66e86b0f2a56eb917ed0cae6a9fee98 Mon Sep 17 00:00:00 2001 From: Joshua Attridge Date: Thu, 23 May 2024 21:07:41 +0100 Subject: [PATCH] fixing iloc in previous_high_low --- smartmoneyconcepts/smc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/smartmoneyconcepts/smc.py b/smartmoneyconcepts/smc.py index b4b0351..eed5ad7 100644 --- a/smartmoneyconcepts/smc.py +++ b/smartmoneyconcepts/smc.py @@ -734,10 +734,10 @@ def previous_high_low(cls, ohlc: DataFrame, time_frame: str = "1D") -> Series: last_broken_time = resampled_ohlc.index[-1] # remove rows with nan values (ignoring weekends) resampled_ohlc = resampled_ohlc.dropna() - previous_high[i] = resampled_ohlc["high"][-2] if len(resampled_ohlc) > 1 else np.nan - previous_low[i] = resampled_ohlc["low"][-2] if len(resampled_ohlc) > 1 else np.nan - currently_broken_high = ohlc["high"][i] > previous_high[i] or currently_broken_high - currently_broken_low = ohlc["low"][i] < previous_low[i] or currently_broken_low + previous_high[i] = resampled_ohlc["high"].iloc[-2] if len(resampled_ohlc) > 1 else np.nan + previous_low[i] = resampled_ohlc["low"].iloc[-2] if len(resampled_ohlc) > 1 else np.nan + currently_broken_high = ohlc["high"].iloc[i] > previous_high[i] or currently_broken_high + currently_broken_low = ohlc["low"].iloc[i] < previous_low[i] or currently_broken_low broken_high[i] = 1 if currently_broken_high else 0 broken_low[i] = 1 if currently_broken_low else 0