chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis

Home Page:https://binance-trading-bot-chrisleekr.cloud.okteto.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Orders closing in negative after reaching sell trigger.

dasbts opened this issue · comments

commented

Bot is selling at negative values, twice the last month. 20% loss even when the bot reached the threshold to trigger trail. Some of my trades have been successful, but two in BTCUSDT have been very bad. I haven't enabled stop loss. The following settings however are used:
Trigger percentage based on the last buy price 1.05
Stop price percentage 0.98
Limit price percentage 0.975
Sell quantity percentage for USDT 1
Sell quantity percentage for BTC 1
Sell quantity percentage for BUSD 1

This is set after reading the Wiki description of the sell scenario many many times.

Version

Running Version: v0.0.96 (209d2e0)
Latest Version: [v0.0.96]

Expected Behaviours

Sell in profit...

Screenshots

image

image

commented

Also after buying the tokens back as I don't want to lose dollars on this trade, (as it was in profit...) it then bought the tokens back, but showed this which scared me so much (and also added all the value to a loss, thus -100% loss).

It was too late buying the tokens back however, because it sold off to a lower price than what the market price was.

(13:39:09.430) BTCUSDT Manual BUY Order Filled: LIMIT

  • Order Result:
    {
    "symbol": "BTCUSDT",
    "orderId": 17240292526,
    "orderListId": -1,
    "clientOrderId": "zRdVmKP2ZbFIUXkr9nBlPe",
    "transactTime": 1673530739398,
    "price": "18106.30000000",
    "origQty": "0.00500000",
    "executedQty": "0.00500000",
    "cummulativeQuoteQty": "90.53150000",
    "status": "FILLED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "workingTime": 1673530739398,
    "fills": [],
    "selfTradePreventionMode": "NONE",
    "stopPrice": "0.00000000",
    "isWorking": false,
    "updateTime": 1673530749111
    }
  • Current API Usage: 40

(13:39:10.158) BTCUSDT Action - Removed last buy price:

  • Message: Balance is not enough to sell. Delete last buy price.
    {
    "lastBuyPrice": 18106.3,
    "baseAssetQuantity": 0.00001,
    "minQty": "0.00001000",
    "baseAssetFreeBalance": "0.00001423",
    "baseAssetLockedBalance": "0.00000000",
    "totalBaseAssetBalance": 0.00001423,
    "openOrders": [
    {
    "symbol": "BTCUSDT",
    "orderId": 17240292526,
    "orderListId": -1,
    "clientOrderId": "zRdVmKP2ZbFIUXkr9nBlPe",
    "price": "18106.30000000",
    "origQty": "0.00500000",
    "executedQty": "0.00000000",
    "cummulativeQuoteQty": "0.00000000",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.00000000",
    "icebergQty": "0.00000000",
    "time": 1673530739398,
    "updateTime": 1673530739398,
    "isWorking": true,
    "workingTime": 1673530739398,
    "origQuoteOrderQty": "0.00000000",
    "selfTradePreventionMode": "NONE",
    "currentPrice": 18109.9,
    "updatedAt": "2023-01-12T13:38:59.398Z"
    }
    ]
    }

Followed by a sell $-90 sell message that I already deleted.

commented

Also I previously tried setting the following to positive values (which in my opinion would be logical, I want it to trigger at 5% and then close as lowest for example at 2% profit), but then it gave me errors that the trade would be executed immediately and nothing ever happened to the sell leading to missed opportunities.

Thus, instead of:
Stop price percentage 0.98
Limit price percentage 0.975

I previously had:
Stop price percentage 1.035
Limit price percentage 1.02

P.s. The minimum profit shown on the "card" in the GUI was about 5 USD, thus it had been trailing for probably a day.

I think you are trading another BTC* pair and thus you are "stealing" BTC from BTCUSDT buy order when other pair trades are closed. You can't trade multiple symbols with the same asset.

commented

Alright, that could well be the case since the initial config came with both XRPUSDT and XRPBTC I decided to give it a try as I thought it had the capability of doing this, but after understanding how it works with selling 100% and seeing why you chose this path instead of logging all the quantities (which maybe could be a good alternative functionality to 100%?) I guess it makes sense.

However, I'm still very confused about stop price and limit price after reading the documentation as well as the issues. Is it correct to set it to the proposed values from the docs if I want it to close at minimum at 2% profit?
Stop price percentage 0.98
Limit price percentage 0.975

Or is it possible to set:
Stop price percentage 1.035
Limit price percentage 1.02

I just don't want to get error again when it's time to trail next time, and neither a loss that could have been prevented by the right config.

However, I'm still very confused about stop price and limit price after reading the documentation as well as the issues. Is it correct to set it to the proposed values from the docs if I want it to close at minimum at 2% profit? Stop price percentage 0.98 Limit price percentage 0.975

It depends on your Trigger percentage. For example, if you trigger is set to 1.02 and limit is 0.98, then (rounded) your minimum profit will be 0%. Trigger price is value when the sell order is created and limit price is lowest price it can be sold for. That mean 1.02 x 0.98 = 0.9996.

If you want to sell at minimum 2% profit then you need to set for example 1.04 trigger percentage and limit 0.981. This will set minimum profit 1.04 x 0.98 = ~1.02.

commented

Ok, great, thank you for the explanation.

However, this led to the new bug (let me know if you want a new issue or renaming this one) where it thought the manual trade buyback (with the "TRADE" button in the GUI) was thought to have 0 as buy price, which in turn led to a message of a loss of the whole value even if no sell trade happened (maybe lucky timing) as expected since I just bought in. Today I see that it sold and I was excited but confused when it said 100 USD profit. So I checked the trade log and see:
image

This happened even tho I adjusted the last buy price (which is required for it to sell at all).