Fix inaccuracy in docs.
This commit is contained in:
parent
98f6fce2ec
commit
9c21c75cf5
@ -52,7 +52,7 @@ An example of how we can set stop-loss and take-profit targets in the dataframe
|
|||||||
class AwesomeStrategy(IStrategy):
|
class AwesomeStrategy(IStrategy):
|
||||||
def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_rate: float,
|
def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_rate: float,
|
||||||
current_profit: float, dataframe: Dataframe, **kwargs) -> bool:
|
current_profit: float, dataframe: Dataframe, **kwargs) -> bool:
|
||||||
trade_row = dataframe.loc[timeframe_to_prev_date(trade.open_date_utc)]
|
trade_row = dataframe.loc[dataframe['date'] == timeframe_to_prev_date(trade.open_date_utc)].squeeze()
|
||||||
|
|
||||||
# Sell when price falls below value in stoploss column of taken buy signal.
|
# Sell when price falls below value in stoploss column of taken buy signal.
|
||||||
if 'stop_loss' in trade_row:
|
if 'stop_loss' in trade_row:
|
||||||
@ -292,7 +292,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.
|
||||||
current_time = timeframe_to_prev_date(self.timeframe, current_time)
|
current_time = timeframe_to_prev_date(self.timeframe, current_time)
|
||||||
current_row = dataframe.loc[current_time]
|
current_row = dataframe.loc[dataframe['date'] == current_time].squeeze()
|
||||||
if 'atr' in current_row:
|
if 'atr' in current_row:
|
||||||
# new stoploss relative to current_rate
|
# new stoploss relative to current_rate
|
||||||
new_stoploss = (current_rate - current_row['atr']) / current_rate
|
new_stoploss = (current_rate - current_row['atr']) / current_rate
|
||||||
|
Loading…
Reference in New Issue
Block a user