beeb / pancaketrade

Limit orders for PancakeSwap
GNU General Public License v3.0
200 stars 91 forks source link

Add feature: trailing SL in % from ATH since entry (refresh each X seconds) #43

Closed alejandrobailo closed 3 years ago

alejandrobailo commented 3 years ago

Hi, first of all, awesome work and thanks a lot!

I think would be fine to set a SL trailing of a x% under the maximum value of the token since the entry.

E.j.

Entry 0.1 SL 10% 0.09 Trainling SL 5% ... 1h later Value 0.3 SL 0.25

beeb commented 3 years ago

Hello,

I think what you want to do can be achieved with 2 orders like so:

Example 1: Entry price 0.1 Price moves above 0.105 -> order 2 starts monitoring Price moves to 0.3 ATH since entry -> order 2 is monitoring Price moves below 0.285 -> order 2 triggers (5% drop from ATH) -> sell

Example 2: Entry price 0.1 Price moves down below 0.09 -> order 1 triggers -> sell

You can choose the activation price for order 2 so it doesn't sell too early for your taste.

alejandrobailo commented 3 years ago

But as I understood, bot says:

OK, I will sell when the price of TOKEN reaches x BNB per token. Next, how much TOKEN do you want me to use for selling? You can also use scientific notation like x or a percentage like 63%. Current balance: x TOKEN

That means bot will sell when the Take profit will be reached, in your example 1 when 0.105

beeb commented 3 years ago

Okay I think this is just a matter of bad documentation and/or messages.

When trailing stop loss (tsl) is activated on a sell order, the order will only execute once the price drops by X% compared to the maximum price during the monitoring period. Monitoring period starts when the price goes above the price value from the order.

alejandrobailo commented 3 years ago

Thanks, just to know which is the refresh rate of the monitoring? (in seconds I guess)

beeb commented 3 years ago

Can be configured in the config file. Default is 5 seconds

beeb commented 3 years ago

Keep in mind that the more tokens you have added or the slower the RPC you use, the more time the script will need to get all the token prices. So effectively it could be slower than the specified amount.