Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
uhliksk opened this issue Aug 7, 2022 · 3 comments · Fixed by #462
Closed
Labels
bug Something isn't working

Comments

@uhliksk
Copy link
Contributor

uhliksk commented Aug 7, 2022

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 uhliksk added the bug Something isn't working label Aug 7, 2022
@uhliksk
Copy link
Contributor Author

uhliksk commented Aug 7, 2022

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

// If the last buy price is recorded, this is one of open trades.
// Deduct 1 from the current open trades and calculate it.
if (lastBuyPrice) {
currentOpenTrades -= 1;
}

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.

@Rayn0r
Copy link

Rayn0r commented Aug 7, 2022

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.

@uhliksk
Copy link
Contributor Author

uhliksk commented Aug 7, 2022

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.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants