I used this code: while True: df = getklines(symbol, interval, lookback) if df is not…
- User
I used this code: while True: df = get_klines(symbol, interval, lookback)
codeif df is not None: signals = signal_generator(df) print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}") if signals == 'buy': client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1) print("Long order executed!") if signals == 'sell': client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1) print("Short order executed!") time.sleep(1)Can you add in my code this algorithm: Set stop loss for long position -10% (#How to count -10% system get entry price by
client.get_account_trades(symbol=symbol)get Entry price of last position after it divide 10% to 50 result will be 0.02% , after it entry price - 0.02% set SL to result number ) Set stop loss for short position -10% (#How to count -10% system get entry price byclient.get_account_trades(symbol=symbol)get Entry price of last position after it divide 10% to 50 result will be 0.02% , after it entry price - 0.02% set SL to result number ) If profit as more than +10% set stop loss to past candle Open - Assistant
- User
Dont set test order please
- Assistant
- User
Past candle code: df = get_klines(symbol, interval, lookback)
- Assistant