This is a fully functioning Binance trading bot that measures the volatility of every coin on Binance and places trades with the highest gaining coins If you like this project consider donating though the Brave browser to allow me to continuously improve the script.
MIT License
3.39k
stars
774
forks
source link
Fixing Trailing Stop Loss to correctly update the stop_loss value #193
In your own words, please share how this makes the codebase better.
when USE_TRAILING_STOP_LOSS is enabled and the take_profit value for a coin is reached the new stop_loss value should be set to just below the existing take_profit (ie take_profit - TRAILING_STOP_LOSS).
Due to the order of the operations this was being incorrectly set to take_profit + TRAILING_TAKE_PROFT - TRAILING_STOP_LOSS
This PR simply switches the order of the operations to update take_profit and stop_loss to prevent the bug.
What are you addressing in this PR
How have you tested this PR
Corrected behaviour has been verified, see below
In your own words, please share how this makes the codebase better.
when USE_TRAILING_STOP_LOSS is enabled and the take_profit value for a coin is reached the new stop_loss value should be set to just below the existing take_profit (ie
take_profit - TRAILING_STOP_LOSS
).Due to the order of the operations this was being incorrectly set to
take_profit + TRAILING_TAKE_PROFT - TRAILING_STOP_LOSS
This PR simply switches the order of the operations to update take_profit and stop_loss to prevent the bug.
Test output
For comparison, existing incorrect behaviour with same params: