chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5.05k stars 1.1k forks source link

Increased trailing take profit functionality #603

Open dasbts opened 1 year ago

dasbts commented 1 year ago

It would be awesome if we would be able to specify both the distance to cancel and the distance to execute for the trailing take profit (TTP), that way we can for example change the sensitivity of when we want a new updated higher TTP limit. For example, I was trying to set a TTP of 2% below the current price by specifying the limit price for the sell orders in the config, but that also seemed to alter the difference to cancel making this interval larger. Thus, I would like to skew the difference to execute to be lower from the trigger price than the difference to cancel is.

So, if I want to TTP at 5% for the position in general, I would like to set an updated minimum profit and updated minimum price to sell at if it increases 0.2% more, leading to the minimum profit being updated to 3.2%.

I tried playing around with my position's limit price and stop price for the sell order as I'm still a bit confused from the Wiki on that, but it seem to not allow skewing in the way I try to describe here. It seems like the current behaviour is some form of median so if I have a difference of 1% to cancel from current price (where it does the trigger sell) and 1% to execute, then when it reaches the cancel it seemingly rises with a step of 1% more, whereas what I would love to see is it stepping up i.e. 0.2% more.

If this is possible, this would allow the user to change the sensitivity of the trailing, while keeping a bit higher difference to execute which can be useful in bull-markets like today's scenario.

A second thought I have is dynamic TTP which allows the user to set a minimum initial trailing limit, for example 2% profit as minimum after 5% trigger price, then increasing the limit slowly towards a maximum TTP.

Maybe even have different values depending on if it's for example a strong buy or neutral TV signal.

rando128 commented 1 year ago

Hi @dasbts, I had similar reflexions on how to control the spread (between limit and stop price) of a trade. It turns out that even if we give control to the end-user (allowing to apply settings manually), you quickly end-up in a never-ending reconfiguration cycle where you try and adapt to the ever-changing market conditions. Eventually you rarely get it right.

This lead me to think about adding a new trending signal. I'm currently testing HeikinAshi trend signal to restrict from selling in a bullish trend and restrict from buying in ongoing bearish trend. I know this is not the solution you suggest, but if the approach makes a positive difference, I'll submit a PR.

dasbts commented 1 year ago

That sounds like a great idea!

Skickat från Outlook för Androidhttps://aka.ms/AAb9ysg


From: rando128 @.> Sent: Wednesday, February 22, 2023 2:24:10 PM To: chrisleekr/binance-trading-bot @.> Cc: dasbts @.>; Mention @.> Subject: Re: [chrisleekr/binance-trading-bot] Increased trailing take profit functionality (Issue #603)

Hi @dasbtshttps://github.com/dasbts, I had similar reflexions on how to control the spread (between limit and stop price) of a trade. It turns out that even if we give control to the end-user (allowing to apply settings manually), you quickly end-up in a never-ending reconfiguration cycle where you try and adapt to the ever-changing market conditions. Eventually you rarely get it right.

This lead me to think about adding a new trending signal. I'm currently testing HeikinAshi trend signal to restrict from selling in a bullish trend and restrict from buying in ongoing bearish trend. I know this is not the solution you suggest, but if the approach makes a positive difference, I'll submit a PR.

— Reply to this email directly, view it on GitHubhttps://github.com/chrisleekr/binance-trading-bot/issues/603#issuecomment-1440012134, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJTXKSP5H5P4XN3ANETTX2DWYYHPVANCNFSM6AAAAAAU5M4L3Y. You are receiving this because you were mentioned.Message ID: @.***>

Rayn0r commented 1 year ago

This lead me to think about adding a new trending signal. I'm currently testing HeikinAshi trend signal to restrict from selling in a bullish trend and restrict from buying in ongoing bearish trend.

I have tried using Heikin Ashi for trading and it did not turn out to be very reliable. It often tends to indicate a reverse in the trend, even though the trend has not ended. SMA is better for this but "sluggish". MACD performed much better, but still not reliable. In general this bot works best, when we are a global uptrend.

And as far as my experience goes, correcting the profit upwards will only work if you drag your stop loss up as well. Taking profit works best if you set yourself a fixed percentage. And you shouldn't care whether or not the price continues to rise above your trigger price. Be disciplined first, before you try to maximize your profit.

The biggest challenge I see, is to configure this bot to buy at the right time.

I'll explain what I see quite often in an example: Let's assume you would like to trade on the 5m time frame: The bot "sees" a drop and is buying after Tradingview has signaled that it is on the rise. Taking a look at the 1h frame, you see that the graph is in a down trend with lots of lower highs and lower lows. During this situation you only make profit as long as you buy at the lower low and sell at the next lower high. Most of the time there are less than 3-4% between the LL and LH. If you wait for TV to signal, there is not a lot of margin left for taking profit. If you are lucky it is 1-2%, mostly less. Buying when the price is in a down trend conflicts with the 1st rule: "Never trade against the trend.". You may say: "Well we have grid trades to counter buying against the trend". Unless you are able put a whole lot of money in there, you can only cover a certain drop percentage of about 10-15% with a margin drop of 1-2%.

And grid trades in my opinion are bad for the following reason: Imagine you start out with $200 on the first grid. You set your stop loss to 0.978 and your take profit to 1.025. You also have 5 grid trades to cover a 10% drop (so a new grid fires after a 2% drop). Now let's say this setting works for 5 consecutive trades on the first grid with $200 each time. Which is a profit of $25 for the amount of money invested. On you next trade you happen to be caught in a down trend. After all grids trades have fired, you have invested close to 4k to cover the drop. If it drops 2.2% more, then stop loss will kick in and you will lose ~$88.

It may just be me, who is not able to configure this beast correctly, but I had more consistent profits trading manually.

Trading while taking several Tradingview time frames into account as in #539, may better the situation.

dasbts commented 1 year ago

I agree, and yes, caring for margin as well when price drops is definitely a more difficult use case as you also have liquidation. In general tho, it's good to care for confluence in the timeframes, which in my opinion (after trying) is a difficult one to implement as there are then more parameters to care about and it's easy to never get any entry scenario at all.