diff --git a/docs/strategy-advanced.md b/docs/strategy-advanced.md index 523d0accd..6d55084b7 100644 --- a/docs/strategy-advanced.md +++ b/docs/strategy-advanced.md @@ -230,15 +230,18 @@ for val in self.buy_ema_short.range: merged_frame = pd.concat(frames, axis=1) ``` -### Adjust trade position +## Adjust trade position `adjust_trade_position()` can be used to perform additional orders to manage risk with DCA (Dollar Cost Averaging) for example. -!!! Tip: The `position_adjustment_enable` configuration parameter must be enabled to use adjust_trade_position callback in strategy. +!!! Note + The `position_adjustment_enable` configuration parameter must be enabled to use adjust_trade_position callback in strategy. -!!! Warning: Additional orders also mean additional fees. +!!! Warning + Additional orders also mean additional fees. -!!! Warning: Stoploss is still calculated from the initial opening price, not averaged price. +!!! Warning + Stoploss is still calculated from the initial opening price, not averaged price. ``` python from freqtrade.persistence import Trade @@ -276,7 +279,7 @@ class DigDeeperStrategy(IStrategy): # Only buy when not actively falling price. last_candle = dataframe.iloc[-1].squeeze() previous_candle = dataframe.iloc[-2].squeeze() - if last_candle.close < previous_candle.close: + if last_candle['close'] < previous_candle['close']: return None count_of_buys = 0 diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 886fdbc59..0026b9561 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -570,19 +570,23 @@ class AwesomeStrategy(IStrategy): ``` -### Adjust trade position +## Adjust trade position `adjust_trade_position()` can be used to perform additional orders to manage risk with DCA (Dollar Cost Averaging). The strategy is expected to return a stake_amount if and when an additional buy order should be made (position is increased). If there is not enough funds in the wallet then nothing will happen. -Note: Current implementation does not support decreasing position size with partial sales! +!!! Note + Current implementation does not support decreasing position size with partial sales! -!!! Tip: The `position_adjustment_enable` configuration parameter must be enabled to use adjust_trade_position callback in strategy. +!!! Tip + The `position_adjustment_enable` configuration parameter must be enabled to use adjust_trade_position callback in strategy. -!!! Warning: Additional orders also mean additional fees. +!!! Warning + Additional orders also mean additional fees. -!!! Warning: Stoploss is still calculated from the initial opening price, not averaged price. +!!! Warning + Stoploss is still calculated from the initial opening price, not averaged price. So if you do 3 additional buys at -7% and have a stoploss at -10% then you will most likely trigger stoploss while the UI will be showing you an average profit of -3%. ``` python