binance-trading-bot icon indicating copy to clipboard operation
binance-trading-bot copied to clipboard

When max. open trades is exceeded not even existing trades will trigger buy orders

Open uhliksk opened this issue 3 years ago • 3 comments

Version

v0.0.88 (9c2e4f5)

Description

If the number of open trades is higher than max. open trades by 2 or more then not even existing open trades will trigger buy orders.

To Reproduce

  1. Open multiple trades. (e.g. 5)
  2. Set max. open trades to much lower value (e.g. 3)
  3. Wait for buy trigger price is reached.
  4. See the buy order is not triggered.

Expected Behaviours

Existing open trades should not be affected by max. open trades parameters.

Screenshots

Additional context

Situation with exceeded number of open trades can occur even without changing max. open trades limit becuase of bug #398.

uhliksk avatar Aug 07 '22 12:08 uhliksk

This doesn't work if number of open trades is exceeded by more than 1 open trade.

https://github.com/chrisleekr/binance-trading-bot/blob/a9319ad7d65235244571f73efa842ffe1cdae86d/app/cronjob/trailingTrade/step/determine-action.js#L151-L155

It should always return false if lastBuyPrice exist to allow buy order in already opened trade to be triggered. To prevent overshooting all open buy orders in Grid Trade #1 should be cancelled immediatelly if there is executed buy order in any Grid Trade #1 reaching max. open trades.

uhliksk avatar Aug 07 '22 13:08 uhliksk

Please have a look at #398 . The buy logic has some flaws. I tried to fix them a few months ago, but did not succeed completely. But I think this is more due to the fact that there are no locks, when buy orders are triggered. I tried to solve the logic problems best way I could. Have a look here if you are interested.

Rayn0r avatar Aug 07 '22 20:08 Rayn0r

Hello @Rayn0r

Thank you for your suggestion. I've seen your code. I think you were on the right way but you made it too complex and some parts are actually unnecessary. I've made much simpler solution which I'm already testing. I'll create PR as soon as my last PR will be merged and then we can discuss the solution there.

uhliksk avatar Aug 07 '22 22:08 uhliksk