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

Enhancements to reduce risks and increase profits #18

Closed
Maxoos opened this issue Mar 1, 2021 · 19 comments
Closed

Enhancements to reduce risks and increase profits #18

Maxoos opened this issue Mar 1, 2021 · 19 comments
Labels
enhancement New feature or request

Comments

@Maxoos
Copy link

Maxoos commented Mar 1, 2021

First of all I have to say I love this little thing!

I have a few ideas to help reduce risk and increase profits:

  1. Place stop-limit orders for buying too, the same way it is done in chaseStopLossLimitOrder. Could probably reuse that function to do both buy and sell.
  2. Seperate params per symbol to manage risk and strategy (maybe even have presets!). For example, BTCDOWN/USDT is more risky, I would like to look at 5m intervals and allow a lower maximum purchase amount just for that coin.
  3. Enable/disable buying per symbol. Sometimes I just want to exit without buying anything new for one specific coin.

Any thoughts? I might have a few hours this week to help out.

@OOtta
Copy link

OOtta commented Mar 1, 2021

I would also like the option to replace the stop-limit orders immediately, instead of waiting for next time the symbol is processed again.

@chrisleekr
Copy link
Owner

chrisleekr commented Mar 1, 2021

@Maxoos that is an amazing idea. I might need to come up with good logic of chase stop-loss limit order for buying.

But yeah, I will try to find out the way.

I will develop the following changes based on your suggestions.

  • Allow entering more decimals for the last buy price
  • Override buy/sell configuration per symbol
  • Use chase-stop-loss-limit order for buy signal as well
  • Enable/Disable symbols transaction, but continue to monitor
  • Override the lowest value in the frontend

@OOtta I am not sure I understand what you mean. Can you elaborate on what you are trying to achieve?

@OOtta
Copy link

OOtta commented Mar 1, 2021

@chrisleekr
If there is an opened Stop-Limit order and price goes higher it cancels the order and sets new order next time it checks that ticker, however if the market is volatile the price might dip down before new order is set and therefore you end up missing possible stop trigger and sell. If you really believe the price is gonna go up its okay, because there will be another opportunity in the future, however i would prefer to have the option to play it safer and from the moment minimum profit price is reached have always stop-limit order in that would just get updated if price goes up.

@kaziqta
Copy link

kaziqta commented Mar 1, 2021

Yeah, experienced the same these days, we all did, I think, this week's dip wasn't pleasant :)
But still, there may be also extension to monitor the trend, EMA 200 does a great job to read the trend.

@Maxoos
Copy link
Author

Maxoos commented Mar 1, 2021 via email

@bavinsCo
Copy link

bavinsCo commented Mar 5, 2021

Guys, join the Telegram group to solve problems with each other ..

https://t.me/joinchat/z3cKyYFcx0NiOTA8

@chrisleekr
Copy link
Owner

@Maxoos

I have updated few features. Although in this release, I haven't applied stop chase limit order for buying. Need some more time for that.

@Maxoos
Copy link
Author

Maxoos commented Mar 6, 2021

@chrisleekr
AMAZING! thank you!

I've made a couple of changes on my local to improve the performance, I simply cannot find the time to post it a PR, can you post them here and you'll consider them?

@chrisleekr
Copy link
Owner

@Maxoos Definitely. I will update if you give me what the changes are.

@Maxoos
Copy link
Author

Maxoos commented Mar 6, 2021

@chrisleekr

  1. This seems to be a bug

    orderResult = await helper.chaseStopLossLimitOrder(

    If the action is 'buy', it will never try to sell even if it's time to sell. You can have buy and sell at the same time if you changes parameters or entered last buy price manually. I think it should simply look for sell order all the time. I took this line outside the condition.

  2. When there's a sharp drop in price, this condition does not work well:

    if (lastCandle.close <= lowestClosed) {

    What I have found is if the last candle is rarely lowestClosed, so under this condition you must wait for the next candle to be lower or equal to the last candle, because the min will never be lowestClosed. I've added some padding around this like so:

  const diff = ((1 - lastCandle.close / lowestClosed) * -100)

  logger.info(
    { symbol, lowestClosed, close: lastCandle.close, diff },
    "Diff indicators"
  );
  if (lastCandle.close <= lowestClosed || diff <= 1) {
/// do something 
}

Ideally you can put the padding in a param to be edited, but 1% seems to work nicely. With this, if in the array of candles the next candle is slightly higher than the min, it will signal 'buy'. I monitored the market it happens all the time, missing those orders. Like in this example:
image

Not sure if my solution is the best, feel free to handle it as you think.

  1. Now when I started to play with this, I placed low orders, around $12. When the value of the coin went down enough, it deleted the last buy price, so I just committed out the two places where you delete the last buy price. Not sure how you solve this one, but I assume it does not happen if you place a $100 order. Unless that coin loses a lot of value.
    await mongo.deleteOne(logger, 'simple-stop-chaser-symbols', {

@chrisleekr
Copy link
Owner

chrisleekr commented Mar 7, 2021

@Maxoos

  1. Handling actions simultaneously

    Ok, I think it's now possible to handle buy/chase-stop-loss-limit-order at a single process.
    In the original concept, the last buy price was configured by the bot and didn't allow to edit manually. Hence, if the buy action has occurred, technically sell action should never be occurred because the minimum selling price will never be met.
    I will update the code to handle both steps in a single process.

  2. Buy price buffer

    Ok, I think I can introduce a new parameter Buy Trigger Percentage. If you configure 1.01 then the trigger price will be 1% over the lowest price. It will give you some padding for the lowest price.

  3. Under $10

    Yes, that is not a bug, it is intended. The reason it removes the last buy price under $10 is that Binance does not allow to place an order under $10 - https://www.binance.com/en-AU/trade-rule.
    Normally, after you sold your coin, it leaves some residue amount of coins, normally under $1. If I don't remove the last buy price, it will continuously monitor chase-stop-loss-limit.

@Maxoos
Copy link
Author

Maxoos commented Mar 7, 2021

@chrisleekr Amazing! thank you for doing this.

@chrisleekr
Copy link
Owner

@Maxoos I am doing this because I also learn from doing it. ;)

Anyway, just note that updated the bot with the following features.

  • Add max-size for logging
  • Execute chaseStopLossLimitOrder on every process
  • Support buy trigger percentage

@Maxoos
Copy link
Author

Maxoos commented Mar 8, 2021

@chrisleekr AMAZING!!! thank you so much. Can't wait to try it.

@chrisleekr chrisleekr added the enhancement New feature or request label Mar 9, 2021
@nithi2023
Copy link

Hi,

When the market price reaches the min sell price, it creates STOP_LOSS_LIMIT with price lower than the original buy price. Can you please let me know when It actually sell?

@kaziqta
Copy link

kaziqta commented Mar 11, 2021

Hi,

When the market price reaches the min sell price, it creates STOP_LOSS_LIMIT with price lower than the original buy price. Can you please let me know when It actually sell?

You are using too low minimum profit %, would suggest you to read how Stop limit orders work in every market

@nithi2023
Copy link

nithi2023 commented Mar 11, 2021

@kaziqta I am using the following settings just to test it out:

Minimum profit percentage : 1.01
Stop price percentage: 0.99
Limit price percentage: 0.985

I am just wondering why it is not selling when market reaches target sell price (1.01 x buy price). It creates STOP_LOSS_LIMIT order with price lower than original buy price.

I am looking to make this bot to buy possible dip and sell it when it reaches profit target. Let me know if I am wrong.

@kaziqta
Copy link

kaziqta commented Mar 11, 2021

@kaziqta I am using the following settings just to test it out:

Minimum profit percentage : 1.01
Stop price percentage: 0.99
Limit price percentage: 0.985

I am just wondering why it is not selling when market reaches target sell price (1.01 x buy price). It creates STOP_LOSS_LIMIT order with price lower than original buy price.

I am looking to make this bot to buy possible dip and sell it when it reaches profit target. Let me know if I am wrong.

I just think that you just don't make effort to make the math. The bot is a good tool, you have to calculate.

Ok, following situation: a 100 position goes up by 1% and you set a sell order for the 99% stop price of 101, which will trigger a sale at 98.5% (limit) of 101. So when the price falls to 99% in regards of 101 you sell for 98.5% price.

Question: at what price will you sell?

@chrisleekr
Copy link
Owner

@Maxoos

The bot has been updated with trailing buy (stop-loss-limit-order for buying).

https://github.com/chrisleekr/binance-trading-bot/releases/tag/v0.0.57

Make sure to go through README.md.

As I introduce a new feature, I did lots of refactoring the code including settings. If the bot version is lower than the version 0.0.57, then the update will cause lost your settings and the last buy price records. You must write down settings and the last buy price records and re-configure after the upgrade.

If experiences any issue, simply delete all docker volumes/images and re-launch the bot.

I close the issue as most features are delivered except Override the lowest value in the frontend. This is already on the list to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants