**Automatischer Crypto-Trading-Bot mit RSI-EMA-Strategie**
Dieser einfache Python-Tradingbot nutzt RSI (Relative Strength Index) und EMA (Exponential Moving Average), um lukrative Einstiege in Trendrichtungen zu erkennen. Ziel: Rebalancing kleiner Positionen auf Binance, geeignet für Anfänger und automatisierbar auf einem VPS.
—
### **Strategieüberblick**
– **RSI EMA(100):** Aufwärtstrend bestätigt.
– Kombination = Long-Setup (Spot-Kauf).
– **Take-Profit / Stop-Loss** automatisch gesetzt.
—
### **Schritt-für-Schritt-Anleitung**
**1. Voraussetzungen installieren**
„`bash
sudo apt update && sudo apt install python3-pip -y
pip3 install ccxt pandas ta
„`
**2. Binance API erstellen**
Gehe zu [binance.com](https://www.binance.com), erstelle API-Schlüssel und erlaube nur Spot-Trading.
**3. Datei `trading_bot.py` erstellen**
„`python
import ccxt
import pandas as pd
from ta.trend import EMAIndicator
from ta.momentum import RSIIndicator
import time
api_key = ‚DEIN_API_KEY‘
api_secret = ‚DEIN_API_SECRET‘
exchange = ccxt.binance({
‚apiKey‘: api_key,
’secret‘: api_secret,
‚enableRateLimit‘: True,
})
symbol = ‚BTC/USDT‘
timeframe = ‚5m‘
amount_usdt = 10
rsi_threshold = 30
def fetch_data():
ohlcv = exchange.fetch_ohlcv(symbol, timeframe, limit=150)
df = pd.DataFrame(ohlcv, columns=[‚time‘,’open‘,’high‘,’low‘,’close‘,’volume‘])
df[‚ema‘] = EMAIndicator(df[‚close‘], window=100).ema_indicator()
df[‚rsi‘] = RSIIndicator(df[‚close‘], window=14).rsi()
return df
def signal(df):
last = df.iloc[-1]
if last[‚rsi‘] last[‚ema‘]:
return ‚buy‘
return ‚hold‘
def execute_trade():
balance = exchange.fetch_balance()
usdt = balance[‚total‘][‚USDT‘]
if usdt < amount_usdt:
print("Nicht genug USDT.")
return
df = fetch_data()
if signal(df) == 'buy':
price = df.iloc[-1]['close']
qty = round(amount_usdt / price, 6)
order = exchange.create_market_buy_order(symbol, qty)
print("Gekauft:", order)
else:
print("Kein Signal.")
while True:
try:
execute_trade()
time.sleep(300) # alle 5 Minuten
except Exception as e:
print("Fehler:", e)
time.sleep(60)
„`
—
### **4. Bot ausführen**
„`bash
python3 trading_bot.py
„`
—
### **5. Automatisch starten (optional)**
Füge in `crontab -e` ein:
„`bash
@reboot nohup python3 /pfad/zum/trading_bot.py &
„`
—
### **Wichtige Hinweise**
– Nur mit kleinem Kapital starten.
– Kein Leverage verwendet.
– Für Futures oder komplexere Strategien Anpassung nötig.
– Kein finanzieller Ratschlag – eigene Verantwortung.
—
**SEO-Keywords**: Crypto Trading Bot, RSI EMA Strategie, Binance Python Trading, automatischer Krypto-Handel, Trading VPS Bot, Python Binance API Tutorial, Krypto Einstiegssignale, RSI Tradingstrategie.
