Open tr0lldermort opened 3 years ago
Looks good, +1 !
@bestnaf I've modified this one to use position size as the control variable. Simpler now to code and will work just as well :)
Instead of this being its own function, it could be tied in with #LSP. Then as the load status increases for either LL or POS_SIZE (which ever the user has configured), we can divide our ROE by each level of very low, low, medium, high, very high and limit reached.
Description
When a position grows in size, the risk for that position also grows. This function will take the size of a position (preferably in margin), and reduce ROE and ROE_LIMIT automatically. This will help close out large, risky positions before & after they turn into bags. The risk of the position can integrated into the #LSP function, and can be evaluated by position size or LS, depending on whether POS_LIM = True (use pos size) or False (use LS). It is also possible to set a negative ROE for ROE_DIV_4 if the user is willing to take a loss for extremely risky positions.
As the margin or LS of the position grows, this function will have four levels to divide the ROE down:
It is worth mentioning that this function will work no matter whether Dynamic ROE is enabled. In other words, it does not matter if we're currently using BASE_ROE, BASE_ROE_LOW or simply ROE to calculate our actual ROE, this function will operate in all cases (when enabled).
Example (if integrated with LSP)
When current pos size is over 1%, then divide ROE by -4.5 and set ROE_LIMIT to 0
Configuration Parameters
<pair>.settings.ROE_DIV = True
# Enable<pair>.settings.ROE_DIV_1 = 1.5
<pair>.settings.ROE_DIV_2 = 2.5
<pair>.settings.ROE_DIV_3 = 4.5
<pair>.settings.ROE_DIV_4 = -4.5
# The 4 divider settings as described aboveIf LS / POS_LIM aren't used, we will need a separate MAX_POS setting:
<pair>.settings.ROE_MAX_POS = 1
# Max pos allowed if not linked to LSP function