im trying to work with the dataframe in custom stoploss but cant make calculations using its data.
for example:
` dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
trade_date = timeframe_to_prev_date(self.timeframe, trade.open_date_utc)
trade_candle = dataframe.loc[dataframe['date'] == trade_date]
p1 = float(trade_candle['stoploss'].iloc[0])
p2 = float(trade_candle['close'].iloc[0])
stoploss = (1-(p1/p2))
return stoploss`
gives File "/workspaces/ft_userdata/user_data/strategies/3LineSupertrendMK1.py", line 266, in custom_stoploss p1 = float(trade_candle['stoploss'].iloc[0]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ File "/home/ftuser/.local/lib/python3.12/site-packages/pandas/core/indexing.py", line 1191, in __getitem__ return self._getitem_axis(maybe_callable, axis=axis) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.12/site-packages/pandas/core/indexing.py", line 1752, in _getitem_axis self._validate_integer(key, axis) File "/home/ftuser/.local/lib/python3.12/site-packages/pandas/core/indexing.py", line 1685, in _validate_integer raise IndexError("single positional indexer is out-of-bounds") IndexError: single positional indexer is out-of-bounds
but simply printing the information is possible for example:
` dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
trade_date = timeframe_to_prev_date(self.timeframe, trade.open_date_utc)
trade_candle = dataframe.loc[dataframe['date'] == trade_date]
print(trade_candle)
print(float(trade_candle['stoploss'].iloc[0]),float(trade_candle['close'].iloc[0]))
stoploss = 0.2
return stoploss`
manages to print the values of the dataframe.
thank you ahead of time for any possible answers.