Fix doc typo

This commit is contained in:
Matthias 2021-05-11 06:23:21 +02:00
parent c4a2de0fd5
commit bcab44560a

View File

@ -293,7 +293,7 @@ class AwesomeStrategy(IStrategy):
# be rounded to previous candle to be used as dataframe index. Rounding must also be # be rounded to previous candle to be used as dataframe index. Rounding must also be
# applied to `trade.open_date(_utc)` if it is used for `dataframe` indexing. # applied to `trade.open_date(_utc)` if it is used for `dataframe` indexing.
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
current_candle = dataframe.loc[-1].squeeze() current_candle = dataframe.iloc[-1].squeeze()
if 'atr' in current_candle: if 'atr' in current_candle:
# new stoploss relative to current_rate # new stoploss relative to current_rate
new_stoploss = (current_rate - current_candle['atr']) / current_rate new_stoploss = (current_rate - current_candle['atr']) / current_rate
@ -312,6 +312,11 @@ class AwesomeStrategy(IStrategy):
return result return result
``` ```
!!! Warning "Using .iloc[-1]"
You can use `.iloc[-1]` here because `get_analyzed_dataframe()` only returns candles that backtesting is allowed to see.
This will not work in `populate_*` methods, so make sure to not use `.iloc[]` in that area.
Also, this will only work starting with version 2021.5.
--- ---
## Custom order timeout rules ## Custom order timeout rules