bestnaf / ARS

ARS addon for Gunbot MM
https://gunbot.ru
10 stars 2 forks source link

Balanced Bag Reduction #21

Open baktu-moon opened 3 years ago

baktu-moon commented 3 years ago

Simple idea for reducing bags similar to FTT that I think would be an improvement. When enabled, we have a trigger for negative ROE expressed as a percentage of our wallet balance. Once our unrealised loss on this pair exceeds this percentage, we activate BBR. This means that whenever any other pair whatsoever closes at a profit, we DCA out of the bag by an equal amount until a target is reached (at which point we either close the position or continue trading, see below). Unlike FTT this does not alter ROE behaviour on other pairs, trading simply continues as normal on other pairs and they close at their normal targets. The intended result of this is that our wallet balance stays the same* (the same minus fees) for a little while , while heavy bags are reduced to safe levels.

PAIR.settings.BBR = True (default False)

PAIR.settings.BBR_TRIGGER = 0.5 (means that when negative ROE on this position >= 0.5% of wallet balance, then BBR is triggered on this pair)

PAIR.settings.BBR_TARGET = 0.1 (BBR will be activated on this pair until the negative ROE on this pair is < 0.1% of wallet balance. If set to 0 BBR will be deactivated only when in positive uPNL for this pair)

PAIR.settings.BBR_CLOSE = True (default False) (if True, BBR will close the position once ROE is greater than BBR_TARGET, otherwise trading will continue as normal on this pair and BBR is deactivated. If ROE on this pair reaches BBR_TRIGGER again, the whole process starts over.

PAIR.settings.BBR_LLIM = True (default False) If True, we require that either liquidation limit OR wallet allocation limit on this pair has been reached before activating BBR. If False, it will be triggered whenever we hit BBR_TRIGGER.

PAIR.settings.BBR_WEIGHTED = True (default False) If False and we have multiple bags under BBR, when we close a trade in positive ROE then BBR will DCA out of its bags by an equal amount each (ROE from last closed trade / number of bags). When BBR_WEIGHTED = True, larger bags will be given a proportionally larger share of the profits to DCA out with. So if I have an ADA bag of $10 and a LINK bag of $20 under BBR, and I close a separate DOT/USD trade at $1 profit, the ADA bag will DCA by $0.33 and the LINK bag by $0.66, but if BBR_WEIGHTED = False, they each DCA by $0.50. This needs to be the same value for all pairs.

tr0lldermort commented 3 years ago

+1, brilliant idea 💎

tr0lldermort commented 3 years ago

I think this will only work when all trading pairs are using the same base. I.e. works on USDT-M, not on COIN-M (not 100% sure on that though). Also an order scaling factor would be useful:

<pair>. settings.BBR_X = 1

This options allows us to set a scaling factor for each reduction order. If a postion closes in 5 USDT profit and BBR_X is set to 1.2 for example, a 6 USDT reduction order will be placed. Conversely if the scaling factor is set to 0.8, a 4 USDT order will be made.

This function feels related to continuous trading mode in the new SGA strat