fix(TrailingSL): use integer index instead of last_updated

I fixed this as discussed, but:
- I didn't use `last()` because it's only available for `DatetimeIndex`
- I didn't use `.iloc[-1]` because there are a lot of stern warnings in the docs do don't use it and I don't want to confuse less technically aligned user by now using it in an "official" sample
- I did use `.iat[-1]` because it's supposed to be fasted by working on the Series of the requested column directly
This commit is contained in:
Joe Schr
2021-03-04 18:32:23 +01:00
parent 640e11f89b
commit a0f8971094
+1 -1
View File
@@ -47,7 +47,7 @@ class TrailingSL(IStrategy):
# so we need to get analyzed_dataframe from dp
dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=pair,
timeframe=self.timeframe)
relative_sl = dataframe[last_updated][SL_INDICATOR_NAME]
relative_sl = dataframe[SL_INDICATOR_NAME].iat[-1]
if (relative_sl is not None):
# print("custom_stoploss().relative_sl: {}".format(relative_sl))