Skip to content

Commit 5ea7ba6

Browse files
committedMar 21, 2025
docs: improve adjust_trade_position docs further
part of freqtrade#11461
1 parent e3e924d commit 5ea7ba6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎docs/strategy-callbacks.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ For performance reasons, it's disabled by default and freqtrade will show a warn
758758

759759
Additional orders also result in additional fees and those orders don't count towards `max_open_trades`.
760760

761-
This callback is also called when there is an open order (either buy or sell) waiting for execution - and will cancel the existing open order to place a new order if the amount, price or direction is different.
761+
This callback is also called when there is an open order (either buy or sell) waiting for execution - and will cancel the existing open order to place a new order if the amount, price or direction is different. Also partially filled orders will be canceled, and will be replaced with the new amount as returned by the callback.
762762

763763
`adjust_trade_position()` is called very frequently for the duration of a trade, so you must keep your implementation as performant as possible.
764764

@@ -770,9 +770,9 @@ Modifications to leverage are not possible, and the stake-amount returned is ass
770770
The combined stake currently allocated to the position is held in `trade.stake_amount`. Therefore `trade.stake_amount` will always be updated on every additional entry and partial exit made through `adjust_trade_position()`.
771771

772772
!!! Danger "Loose Logic"
773-
On dry and live run, this function will be called every `throttle_process_secs` (default to 5s). If you have a loose logic, for example your logic for extra entry is only to check RSI of last candle is below 30, then when such condition fulfilled, your bot will do extra re-entry every 5 secs until either it run out of money, it hit the `max_position_adjustment` limit, or a new candle with RSI more than 30 arrived.
773+
On dry and live run, this function will be called every `throttle_process_secs` (default to 5s). If you have a loose logic, (e.g. increase position if RSI of the last candle is below 30), your bot will do extra re-entry every 5 secs until you either it run out of money, hit the `max_position_adjustment` limit, or a new candle with RSI more than 30 arrived.
774774

775-
Same thing also can happen with partial exit. So be sure to have a strict logic and/or check for the last filled order.
775+
Same thing also can happen with partial exit. So be sure to have a strict logic and/or check for the last filled order and if an order is already open.
776776

777777
!!! Warning "Performance with many position adjustments"
778778
Position adjustments can be a good approach to increase a strategy's output - but it can also have drawbacks if using this feature extensively.

0 commit comments

Comments
 (0)