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

how to add stop loss? #8

Open
alimaz1921 opened this issue Apr 28, 2021 · 3 comments
Open

how to add stop loss? #8

alimaz1921 opened this issue Apr 28, 2021 · 3 comments

Comments

@alimaz1921
Copy link

This is a great project to learn using python in market. but as you know, stop loss is an essential point which is ignored in this code.
How can I add a dynamic stop loss in this code?

@ghost
Copy link

ghost commented May 13, 2021

If you need help with bot customization, you can ping me at [email protected] and I will programm it for you

@Momegaii
Copy link

try use thresholds by change percent or current price change by using if conditions like

..code=

**if current_ price(change%) < previous_price(change) :
def sell (symbol,quantity) ;
print (STOP_LOSS)

global_variables:
Symbol="btc"#for_example
quantity = #adjust it (add your quantity)
price_change/current_change = #add nums from to**


(python3)

@Momegaii
Copy link

**another way by :
adding 2 sell functions and price for each one (main sell for tp) (second sell for sL) by using if conditions in (python3)
*if current_ price(change%) < previous_price(change) :
def sell (symbol,quantity) ;
print (STOP_LOSS)

*if current_ price(change%) > previous_price(change) :
def sell (symbol,quantity) ;
print (TAKE_PROFIT)

GLOBAL VARIABLES:
symbol = "btc"#for_example
Quantity = #adjust it (add your quantity)
current_price = client.get.ticker or websocket (current realtime streams price) or get.klines.interval(1) (candelsticks price closed)**

and the best for you to make it as a main condition not an else: bcs it will follow the sequence of your functions .....

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

No branches or pull requests

2 participants