0, 0)).rolling(window=14).mean() loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean() rs = gain / loss rsi = 100 - (100 / (1 + rs)) current_rsi = rsi.iloc[-1] ema_fast_current = ema_fast.iloc[-1] ema_slow_current = ema_slow.iloc[-1] ema_fast_prev = ema_fast.iloc[-2] ema_slow_prev = ema_slow.iloc[-2] # Trading logic bullish_cross = (ema_fast_prev <= ema_slow_prev) and (ema_fast_current > ema_slow_current) bearish_cross = (ema_fast_prev >= ema_slow_prev) and (ema_fast_current < ema_slow_current) print(f"[{now()}] {symbol}: RSI={current_rsi:.1f}, BullCross={bullish_cross}, BearCross={bearish_cross}") # Enter LONG if bullish crossover and RSI oversold if bullish_cross and current_rsi < 35: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🟢 LONG SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'buy', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 + TP_PCT) # Assume TP hit pnl_pct = ((exit_price - entry_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'long', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True # Enter SHORT if bearish crossover and RSI overbought elif bearish_cross and current_rsi > 65: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🔴 SHORT SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'sell', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 - TP_PCT) # Assume TP hit pnl_pct = ((entry_price - exit_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'short', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True except Exception as e: print(f"Error analyzing {symbol}: {e}") return False def main_loop(): print(f"[{now()}] 🤖 STARTING COMPLETE SAFE TRADING BOT") exchange = build_exchange() while True: try: print(f"\n[{now()}] === SCANNING ROUND ===") trades_this_round = 0 for symbol in SYMBOLS: if trade_count >= 3: # Max 3 trades per session print(f"🏁 MAX TRADES REACHED: {trade_count}/3 - Waiting 1 hour") time.sleep(3600) # Wait 1 hour trade_count = 0 # Reset counter continue if check_trading_signals(exchange, symbol): trades_this_round += 1 print(f"🎯 Trade executed! Total today: {trade_count}") time.sleep(2) # Small delay between symbols print(f"[{now()}] 📊 Scan complete. Trades today: {trade_count}") time.sleep(30) # Wait 30 seconds between scans except Exception as e: print(f"Main loop error: {e}") time.sleep(10) if __name__ == '__main__': main_loop() see the results I keep getting io-bot:~/trading-bot$ python3 check_positions.py [2025-11-07T20:39:28.774002+00:00] 🔍 CHECKING TRADES & POSITIONS ============================================================ 📊 RECENT TRADES: 2025-10-17T11:14:55.616278+00:00 | WIF_USDT | SHORT | Entry: 0.48560000 | Exit: 0.50060000 | SL | PnL: -9.27% 2025-10-17T11:15:12.597134+00:00 | BONK_USDT | SHORT | Entry: 0.00001345 | Exit: 0.00001387 | SL | PnL: -9.37% 2025-10-17T11:17:34.219548+00:00 | PEPE_USDT | SHORT | Entry: 0.00000641 | Exit: 0.00000661 | SL | PnL: -9.27% 2025-10-17T11:25:22.291361+00:00 | DOGE_USDT | SHORT | Entry: 0.17819000 | Exit: 0.18364000 | SL | PnL: -9.18% 2025-10-17T13:24:59.282992+00:00 | BONK_USDT | SHORT | Entry: 0.00001390 | Exit: 0.00001383 | TP | PnL: +1.51% ============================================================ (venv) ubuntu@gate-io-bot:~/trading-bot$ cd ~/trading-bot (venv) ubuntu@gate-io-bot:~/trading-bot$ rm safe_bot.py rm: cannot remove 'safe_bot.py': No such file or directory (venv) ubuntu@gate-io-bot:~/trading-bot$ Read from remote host 84.8.128.142: Software caused connection abort Connection to 84.8.128.142 closed. client_loop: send disconnect: Broken pipe ~ $"I asked someone that send reversal trend shls be added that it will be more. Calculated h"> 0, 0)).rolling(window=14).mean() loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean() rs = gain / loss rsi = 100 - (100 / (1 + rs)) current_rsi = rsi.iloc[-1] ema_fast_current = ema_fast.iloc[-1] ema_slow_current = ema_slow.iloc[-1] ema_fast_prev = ema_fast.iloc[-2] ema_slow_prev = ema_slow.iloc[-2] # Trading logic bullish_cross = (ema_fast_prev <= ema_slow_prev) and (ema_fast_current > ema_slow_current) bearish_cross = (ema_fast_prev >= ema_slow_prev) and (ema_fast_current < ema_slow_current) print(f"[{now()}] {symbol}: RSI={current_rsi:.1f}, BullCross={bullish_cross}, BearCross={bearish_cross}") # Enter LONG if bullish crossover and RSI oversold if bullish_cross and current_rsi < 35: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🟢 LONG SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'buy', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 + TP_PCT) # Assume TP hit pnl_pct = ((exit_price - entry_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'long', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True # Enter SHORT if bearish crossover and RSI overbought elif bearish_cross and current_rsi > 65: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🔴 SHORT SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'sell', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 - TP_PCT) # Assume TP hit pnl_pct = ((entry_price - exit_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'short', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True except Exception as e: print(f"Error analyzing {symbol}: {e}") return False def main_loop(): print(f"[{now()}] 🤖 STARTING COMPLETE SAFE TRADING BOT") exchange = build_exchange() while True: try: print(f"\n[{now()}] === SCANNING ROUND ===") trades_this_round = 0 for symbol in SYMBOLS: if trade_count >= 3: # Max 3 trades per session print(f"🏁 MAX TRADES REACHED: {trade_count}/3 - Waiting 1 hour") time.sleep(3600) # Wait 1 hour trade_count = 0 # Reset counter continue if check_trading_signals(exchange, symbol): trades_this_round += 1 print(f"🎯 Trade executed! Total today: {trade_count}") time.sleep(2) # Small delay between symbols print(f"[{now()}] 📊 Scan complete. Trades today: {trade_count}") time.sleep(30) # Wait 30 seconds between scans except Exception as e: print(f"Main loop error: {e}") time.sleep(10) if __name__ == '__main__': main_loop() see the results I keep getting io-bot:~/trading-bot$ python3 check_positions.py [2025-11-07T20:39:28.774002+00:00] 🔍 CHECKING TRADES & POSITIONS ============================================================ 📊 RECENT TRADES: 2025-10-17T11:14:55.616278+00:00 | WIF_USDT | SHORT | Entry: 0.48560000 | Exit: 0.50060000 | SL | PnL: -9.27% 2025-10-17T11:15:12.597134+00:00 | BONK_USDT | SHORT | Entry: 0.00001345 | Exit: 0.00001387 | SL | PnL: -9.37% 2025-10-17T11:17:34.219548+00:00 | PEPE_USDT | SHORT | Entry: 0.00000641 | Exit: 0.00000661 | SL | PnL: -9.27% 2025-10-17T11:25:22.291361+00:00 | DOGE_USDT | SHORT | Entry: 0.17819000 | Exit: 0.18364000 | SL | PnL: -9.18% 2025-10-17T13:24:59.282992+00:00 | BONK_USDT | SHORT | Entry: 0.00001390 | Exit: 0.00001383 | TP | PnL: +1.51% ============================================================ (venv) ubuntu@gate-io-bot:~/trading-bot$ cd ~/trading-bot (venv) ubuntu@gate-io-bot:~/trading-bot$ rm safe_bot.py rm: cannot remove 'safe_bot.py': No such file or directory (venv) ubuntu@gate-io-bot:~/trading-bot$ Read from remote host 84.8.128.142: Software caused connection abort Connection to 84.8.128.142 closed. client_loop: send disconnect: Broken pipe ~ $"I asked someone that send reversal trend shls be added that it will be more. Calculated h"> 0, 0)).rolling(window=14).mean() loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean() rs = gain / loss rsi = 100 - (100 / (1 + rs)) current_rsi = rsi.iloc[-1] ema_fast_current = ema_fast.iloc[-1] ema_slow_current = ema_slow.iloc[-1] ema_fast_prev = ema_fast.iloc[-2] ema_slow_prev = ema_slow.iloc[-2] # Trading logic bullish_cross = (ema_fast_prev <= ema_slow_prev) and (ema_fast_current > ema_slow_current) bearish_cross = (ema_fast_prev >= ema_slow_prev) and (ema_fast_current < ema_slow_current) print(f"[{now()}] {symbol}: RSI={current_rsi:.1f}, BullCross={bullish_cross}, BearCross={bearish_cross}") # Enter LONG if bullish crossover and RSI oversold if bullish_cross and current_rsi < 35: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🟢 LONG SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'buy', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 + TP_PCT) # Assume TP hit pnl_pct = ((exit_price - entry_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'long', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True # Enter SHORT if bearish crossover and RSI overbought elif bearish_cross and current_rsi > 65: qty = calculate_position_size(exchange, symbol, RISK_USDT, LEVERAGE) if qty > 0: ticker = exchange.fetch_ticker(symbol) entry_price = float(ticker['last']) print(f"🔴 SHORT SIGNAL: {symbol} @ {entry_price:.8f}") # Place order order = place_order(exchange, symbol, 'sell', qty) if order: # Simulate trade outcome exit_price = entry_price * (1 - TP_PCT) # Assume TP hit pnl_pct = ((entry_price - exit_price) / entry_price) * 100 * LEVERAGE log_trade(symbol, 'short', entry_price, exit_price, 'TP', pnl_pct) trade_count += 1 return True except Exception as e: print(f"Error analyzing {symbol}: {e}") return False def main_loop(): print(f"[{now()}] 🤖 STARTING COMPLETE SAFE TRADING BOT") exchange = build_exchange() while True: try: print(f"\n[{now()}] === SCANNING ROUND ===") trades_this_round = 0 for symbol in SYMBOLS: if trade_count >= 3: # Max 3 trades per session print(f"🏁 MAX TRADES REACHED: {trade_count}/3 - Waiting 1 hour") time.sleep(3600) # Wait 1 hour trade_count = 0 # Reset counter continue if check_trading_signals(exchange, symbol): trades_this_round += 1 print(f"🎯 Trade executed! Total today: {trade_count}") time.sleep(2) # Small delay between symbols print(f"[{now()}] 📊 Scan complete. Trades today: {trade_count}") time.sleep(30) # Wait 30 seconds between scans except Exception as e: print(f"Main loop error: {e}") time.sleep(10) if __name__ == '__main__': main_loop() see the results I keep getting io-bot:~/trading-bot$ python3 check_positions.py [2025-11-07T20:39:28.774002+00:00] 🔍 CHECKING TRADES & POSITIONS ============================================================ 📊 RECENT TRADES: 2025-10-17T11:14:55.616278+00:00 | WIF_USDT | SHORT | Entry: 0.48560000 | Exit: 0.50060000 | SL | PnL: -9.27% 2025-10-17T11:15:12.597134+00:00 | BONK_USDT | SHORT | Entry: 0.00001345 | Exit: 0.00001387 | SL | PnL: -9.37% 2025-10-17T11:17:34.219548+00:00 | PEPE_USDT | SHORT | Entry: 0.00000641 | Exit: 0.00000661 | SL | PnL: -9.27% 2025-10-17T11:25:22.291361+00:00 | DOGE_USDT | SHORT | Entry: 0.17819000 | Exit: 0.18364000 | SL | PnL: -9.18% 2025-10-17T13:24:59.282992+00:00 | BONK_USDT | SHORT | Entry: 0.00001390 | Exit: 0.00001383 | TP | PnL: +1.51% ============================================================ (venv) ubuntu@gate-io-bot:~/trading-bot$ cd ~/trading-bot (venv) ubuntu@gate-io-bot:~/trading-bot$ rm safe_bot.py rm: cannot remove 'safe_bot.py': No such file or directory (venv) ubuntu@gate-io-bot:~/trading-bot$ Read from remote host 84.8.128.142: Software caused connection abort Connection to 84.8.128.142 closed. client_loop: send disconnect: Broken pipe ~ $"I asked someone that send reversal trend shls be added that it will be more. Calculated h">
JustCopy.ai Clone with JustCopy