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

Trailing stop on exchange #9662

Open
manarbenkraouda opened this issue Jan 9, 2024 · 6 comments
Open

Trailing stop on exchange #9662

manarbenkraouda opened this issue Jan 9, 2024 · 6 comments
Labels
Enhancement Enhancements to the bot. Get lower priority than bugs by default. Stoploss Related to stoploss

Comments

@manarbenkraouda
Copy link

Describe the enhancement

Hi guys! I wondered if it was possible to implement the trailing stop directly on the exchange. I saw that it was available in most of the exchanges, even Kraken Pro added it very recently.

I think it could be a good thing as it gives trades a better reliability and Freqtrade won't make any API calls to adjust manually the stop loss.

What do you guys think about it?

Thanks!

@xmatthias xmatthias added the Question Questions - will be closed after some period of inactivity. label Jan 9, 2024
@xmatthias
Copy link
Member

xmatthias commented Jan 9, 2024

Please get used to filling out the issue template. Those who frequently omit the template may have their issues closed without comment.
We're asking some very basic questions - by deleting the issue template, you're explicitly choosing not to answer our questions.

Filling out the template helps reduce our workload, and we greatly appreciate that.


stoploss on exchange is available for several exchanges (including kraken iirc) - and it'll also work in a trailing setup - where freqtrade will trail the order behind current price, based on the settings given (obviously by replacing the order).

@xmatthias xmatthias added the Stoploss Related to stoploss label Jan 9, 2024
@manarbenkraouda
Copy link
Author

I'm sorry, the only question I had in the template was about the environment I use but it is not applicable here as it is a feature request, right?

Yes I know I'm using it and it works great for now! I'm talking about something else, Bybit for example has a built in Trailing Stop order type that functions on Bybit server (see attached). Freqtrade implements its own trailing stop loss by replacing a conditional limit order every stoploss_on_exchange_interval seconds.

image
image

@xmatthias
Copy link
Member

xmatthias commented Jan 9, 2024

the only question I had in the template was about the environment I use but it is not applicable here as it is a feature request, right?

Well that's not the point.
We ask the same for every issue independent of the type as we've had cases where feature requests were based on an old version, with the feature actually already beeing available - or where it turned out not to be a feature request, but a problem instead.


well but what's the point exactly?
it's a slighlty different type of order - but what the point for algo-trading?

replacing an order every minute is not actually rate-limit relevant ... not unless you have 1000nds of open pairs, where you'll have other timing-problems, too.

We'll also still have to check the order every iteration (it could've filled every instance) ... so while i understand that it's a nice feature for manual trading - i'm not entirely sure what benefits we would expect from placing this (maybe you can elaborate on your expectations a bit further, as in - what's the expected benefit )...

@manarbenkraouda
Copy link
Author

Oh okok I see, I didn't know about this. I actually made sure the feature was not available yet and no one else asked the same question so I thought it wasn't necessary. I'll do it next time for sure!


The point is that, in the Freqtrade documentation it is recommended not to use a 5 seconds or less stoploss_on_exchange_interval (I know that is an example).

The thing is, I'm using a high leverage strategy that perform ok right now, but that would do even better with the trailing stops managed directly by the exchange as the stop loss limit order is moved up or down at tick level.

For example, I've observed some trades live of 1 big candles moving very fast, and the fact that the trailing stop was delayed prevented itself from exiting at the best prices. I know it will happen again, and I'm fine with it, I still made profits, but I think being able to take advantage of very fast trailing stop callback adjustment that are basically free of resources from the bot would be a great thing.

Maybe I'm a fool and it won't change anything, you tell me! 😆

Also, I'm aware that we do in fact have to check the order every iteration, but just to check its status, not actually canceling and replacing orders.

@xmatthias
Copy link
Member

xmatthias commented Jan 10, 2024

... as the stop loss limit order is moved up or down at tick level.

I'm not sure if that is actually true, and neither binance nor bybit's help pages seem to offer an answer on this question.
While they claim that it'll follow price - neither of the two mention tick-level precision, but i'm more than happy to get resources that confirm this.


at least on binance - there also seem quite stringent restrictions about the actual trailing price (20% on spot markets 0.1-5% on futures markets) ... which would essentially mean that for us to be able to activate such a trailing stop, we'd have to enforce that the stoploss is within acceptable levels.

There could for sure be a fallback to existing trailing-stop ordertypes - but then you get into other oddities (a trailing stop on binance will always be a stop-market - while on spot, it'll always be a spot-limit ... essentially voiding the benefit of a trailing stoploss - as it requires a fixed exit rate still.

Bybit seems slightly more flexible in that regard - at least reading through the doc pages.

sources for what i found after a quick research ... :
binance
bybit

@manarbenkraouda
Copy link
Author

neither of the two mention tick-level precision, but i'm more than happy to get resources that confirm this.
I can't find it as well, when I use it on Bybit I can see the order getting updated like 3-4 times per second when the price is moving favorably.


Yep you're right on the restrictions, but I don't think it's that of a big deal, FQ already has "per exchange" guidelines and specific notes (https://www.freqtrade.io/en/stable/exchanges/).

while on spot, it'll always be a spot-limit ... essentially voiding the benefit of a trailing stoploss - as it requires a fixed exit rate still.

Not really, I think the limit order is not a fixed rate exit as it is placed automatically by Binance on the order book when the price changes favorably. It's true that you may not be filled but it is a caveat worth noting on the exchange notes that should not be "disqualifying" imho

@xmatthias xmatthias added Enhancement Enhancements to the bot. Get lower priority than bugs by default. and removed Question Questions - will be closed after some period of inactivity. labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhancements to the bot. Get lower priority than bugs by default. Stoploss Related to stoploss
Projects
None yet
Development

No branches or pull requests

2 participants