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

Add trailing stop loss. #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

twilker
Copy link

@twilker twilker commented Dec 18, 2021

I added the possibility to set a trailing stop loss. With that it is possible to get out before the target profit percentage when a certain stop loss occurred. It also enables the function to find the peak by only setting the stop loss. To achieve this the target profit has to be set to a ridiculous amount.

SniperService.cs Outdated
@@ -192,6 +192,7 @@ private async Task PairCreated(PairCreatedEvent pair)
Log.Logger.Information("Buying Token pair: {0} WHITELISTED ADDRESS: {1}", symbol, addressWhitelisted);
}
await _tradeHandler.Buy(otherPairAddress, otherTokenIdx, pair.Pair, _sniperConfig.AmountToSnipe);
await _tradeHandler.Approve(otherPairAddress);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we approve the pair after buying?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Assuming you turn of the honeypot detection, It never approves the pair before the actual sell. Therefore the sell will fail.

Copy link
Owner

@JayArrowz JayArrowz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, 1st contributor PR! 💯
just a few comments

@JayArrowz
Copy link
Owner

JayArrowz commented Dec 21, 2021

Will merge in later on today and create a new release. Good stuff @twilker

…it did not check whether a buy was placed or not.
@twilker
Copy link
Author

twilker commented Jan 5, 2022

Added a small fix, as it was approving every time liquidity was added.

@bolaidedd
Copy link

Hello guys, with SniperService.cs modified by twilker and the •original repo files from JayArrowz the bot now approve but fails same to sell with this error Fail with error 'PancakeRouter: INSUFFICIENT_OUTPUT_AMOUNT€'
For sure caused by a low slippage. Is this possible to add the function for modify slippage sell?

Thanks for your work

•Original repo files i mean the latest files provided by JayArrowz

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

Successfully merging this pull request may close these issues.

3 participants