Update stoploss_from_open documentation for leverage adjustment

This commit is contained in:
Matthias
2023-03-08 19:35:26 +01:00
parent 027e023443
commit 0318486bee
3 changed files with 11 additions and 8 deletions

View File

@@ -90,17 +90,18 @@ def stoploss_from_open(
leverage: float = 1.0
) -> float:
"""
Given the current profit, and a desired stop loss value relative to the open price,
Given the current profit, and a desired stop loss value relative to the trade entry price,
return a stop loss value that is relative to the current price, and which can be
returned from `custom_stoploss`.
The requested stop can be positive for a stop above the open price, or negative for
a stop below the open price. The return value is always >= 0.
`open_relative_stop` will be considered as adjusted for leverage if leverage is provided..
Returns 0 if the resulting stop price would be above/below (longs/shorts) the current price
:param open_relative_stop: Desired stop loss percentage relative to open price
:param open_relative_stop: Desired stop loss percentage, relative to the open price,
adjusted for leverage
:param current_profit: The current profit percentage
:param is_short: When true, perform the calculation for short instead of long
:param leverage: Leverage to use for the calculation