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

Stop Loss #99

Closed
uduluiz opened this issue Apr 15, 2021 · 20 comments · Fixed by #77
Closed

Stop Loss #99

uduluiz opened this issue Apr 15, 2021 · 20 comments · Fixed by #77
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@uduluiz
Copy link

uduluiz commented Apr 15, 2021

Congratulations on the code! I'll start testing it!

A doubt! Does he have no stop loss in the event of a sharp drop in the price?

It would be interesting to be able to define a parameter for losses, for example I buy a coin at 100, and during the day it starts to fall, if it falls more than 5% of the purchase price I can define a parameter to trigger a sales order by example and so I get out of the coin without a very big loss.

@uduluiz uduluiz added the question Further information is requested label Apr 15, 2021
@chopeta
Copy link

chopeta commented Apr 15, 2021

There's no SL implemented.
The developer don't like the idea.
But you can code it on your own.
There's a few mentions to this topic in the already closed issues, please search for it.

@chrisleekr
Copy link
Owner

Yeah, I have been against implementing STOP LOSS features, but it seems a lot of people are asking for the feature. Maybe I should think twice.

Let's make this issue a discussion page for the STOP-LOSS feature.

My thought with STOP-LOSS was, it won't work with this bot because the bot's buy strategy is to buy the coin at the lowest price within the period.

Let's assume there is STOP-LOSS feature.

  1. When the price falls, then the bot purchased the coin.
  2. The price continuously falls, then the bot sold the coin because it reached STOP-LOSS price.
  3. ISSUE If the price is the lowest price because it kept falling down, then the bot will purchase the coin again. And if the price continuously falls again, then it will sell the coin and buy and sell. Keep losing the money.

So to overcome the above issue, what if I implement extra protection such as "Do not buy for 30 mins if you sold the coin with STOP-LOSS"?

@chrisleekr chrisleekr added the help wanted Extra attention is needed label Apr 16, 2021
@Maxoos
Copy link

Maxoos commented Apr 16, 2021

@chrisleekr I guess for stop loss you can flag that such event has happened and for what price, and lock the coin from buying. The only way to unlock it is by having the price increased by x from the stop loss price. However, not sure how useful it'll be.

@bummar
Copy link

bummar commented Apr 16, 2021

Yes the problem its the rebuy, if when stop loss its activated the buy opción its disable for this coin and only can reactivated manual?

@chrisleekr
Copy link
Owner

@Maxoos all coins behave differently, so I am also not sure automatically unlock based on the price change will work.
I also agree with @bummar like manually reactivating the coin to buy again.

So the steps will be like this:

  • Set minimum loss for the sell order - i.e. -20%
  • Set minutes to disable the buy after executing STOP-LOSS order - 360minutes (6hours)
    • If you want to permanently, simply set 999999 minutes.
  • If the loss is reaching -20%, the bot will place a MARKET order for the coin.
  • And the bot will disable to buy the coin for 6 hours. The coin panel should display "The buy will resume after 360 minutes"
  • You should be able to reactivate buy manually in the coin panel - "Resume" button

Sounds right?

@bummar
Copy link

bummar commented Apr 16, 2021

Sounds Great!

@chrisleekr
Copy link
Owner

I have added this feature to TODO list. I will work on it when I get time.

@jovicon
Copy link

jovicon commented Apr 19, 2021

Hi, I want to contribute in this repo. Can I take a task?

@chrisleekr
Copy link
Owner

@jovicon

You are more than welcome to contribute. I have a list of things to do on the TODO list.
However, I have done massive refactoring of the code in this PR - #77 (comment)

So you may want to wait for this merge or branch out from this PR branch.

@jovicon
Copy link

jovicon commented Apr 19, 2021

Great @chrisleekr I will take a look on the TODO list.
Just let me know when you are okay with refactoring.

Question, if I take a task. It is assigned or anyone else can take it?

@jovicon
Copy link

jovicon commented Apr 19, 2021

I can take this one:
Develop simple setup screen for secrets

@chrisleekr
Copy link
Owner

I think simply take a task from here - https://github.com/chrisleekr/binance-trading-bot#changes--todo

And push the PR first to make sure to let others know you are working on it.

Then others will not take what you are working on it.

Also, make sure you link the issue in the PR like below:

image

With PR #77, it is resolving the issues

@chrisleekr
Copy link
Owner

I can take this one:
Develop simple setup screen for secrets

Definitely, let's open new issue to discuss how to implement that feature.

@chrisleekr
Copy link
Owner

Ok, I will start working on this feature on PR #77.

@mr-matt-b
Copy link

mr-matt-b commented May 4, 2021

I was under the impression that the idea of a trailing stop loss strategy was to set a sell stop-limit below the buy price, and then as the price increases, cancel and re-apply new stop-limits.

For example, if you bought at $100, you'd set a sell stop limit immediately for $99, so your biggest loss possible is $1.

Then if the price rose to $105 in the next tick, you'd cancel and put a sell stop-limit in for $103.95, for a $3.95 minimum profit at that point.

With the re-buy problem, as long as the your buy stop-limit percentage value is sufficiently higher than the lowest price, it wont be able to re-buy straight away, even after a big drop, unless the market heads up again until it reaches your buy stop-limit, in which case you may actually want it to buy at that point, since there are signs it's heading back up.

So effectively, setting the minimum profit to 0 will make the app set a sell stop limit immediately, no matter what, and then slowly increase that stop-limit as the price rises.

Am I missing something? Should the app not be used this way?

Edit - -

That being said, another value for the initial sell stop limit percentage would be nice. You may want a larger area of wiggle room for the price to fluctuate before selling after the initial purchase, rather than the small amount you want to sell at if the price starts dropping after reaching your minimum profit amount.

@chrisleekr
Copy link
Owner

chrisleekr commented May 4, 2021

@premm

For example, if you bought at $100, you'd set a sell stop limit immediately for $99, so your biggest loss possible is $1.

If you want to that method, you would put the selling trigger percentage as 1, which will trigger a selling stop-limit order with the last buy price.

So effectively, setting the minimum profit to 0 will make the app set a sell stop limit immediately, no matter what, and then slowly increase that stop-limit as the price rises.

Ah, so you got the concept. Good.

Am I missing something? Should the app not be used this way?

Most people are using the bot with a sell trigger percentage higher than 1 to preserve minimum profit. If you calculate commissions, by placing the stop-loss limit order with the last buy price will lose commission + the percentage of the sell limit price.

This feature will give an option to traders to limit their loss after purchasing the coin. Acting as a real stop-loss feature.

Hope I made it clear.

@chrisleekr
Copy link
Owner

image
image
image

Testing.

@GrigorovskyA
Copy link

@chrisleekr Nice! I can't wait to try this feature! With my super agro strategy :)

@chrisleekr
Copy link
Owner

Ok, stop loss has been committed to PR #77.
Please take a look comment - #77 (comment)

@hurrykee
Copy link

Thank you very much chrisleekr, I really like this robot, it has successfully run on my VPS.

I very much look forward to this stop loss function, which can be released as soon as possible.

In this way, I can use the robot to obtain higher short-term income.

introduce another very good trading robot. You can refer to this product strategy.

https://www.pionex.com/en-US/

My English is not very good, this message is translated by Google.

chrisleekr added a commit that referenced this issue May 21, 2021
…ements (#77)

- Updated frontend to display version - #59
- Support monitoring multiple coins simultaneously - #77
- Added docker-stack.yml for the Portainer - @hipposen
- Fixed precision issues for some FIAT - #90
- Improved frontend & settings UI - #93 #85
- Support all symbols - #104
- Added stop loss feature - #99
- Stabilised Local Tunnel, cronjob and Binance WebSocket
- Prevented to place new order when the API limit reached - #163
- Added NPM task for building docker image on Windows by @garyng - #175

Co-authored-by: GaryNg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
9 participants